Pseudo random number generator
December 27, 2019
finished P RNG board
Random numbers are often used in video games, encoding or something else you want. In my case, I wanted to try a hardware RNG for myself. There are several types of how to create such numbers:
I tried a few types and decided to continue with the ring-oscillator:
Here you can see the circuit diagram of a 3 stage oscillator. Because of the self feeding input, it's named "ring".
ring oszi
The switching diagram is like the following:
1 1 0
1 0 0
0 0 1
0 1 1
0 1 0
1 1 0
1 0 0
and so on ...
After making such a circuit, I added some logic to access or save the number. This extra circuit was a simple register, on the other side of the PCB. Two weeks later, I had 16 of these boards soldered together and mounted on a main board.
Each of the PCBs, has some different values for the resistors and capacitors (By the way, don't use e-caps!). So every board, oscillates with a varied frequency.
The 16 frequencies are:
7.14kHz 2.09kHz 7.08kHz 1.89kHz 4.75kHz 4.11kHz 2.79kHz 2.16kHz
4.13kHz 5.23kHz 3.60kHz 2.78kHz 4.77kHz 2.85kHz 259Hz 1.63kHz
One important thing: The signal should be the same time on and off.
Additionally, the schematic representation of my two-sided PCB:
schematic of the complete circuit
The backside:
The board (It is the side, with the three colorful caps standing away) looks really simple. Because of the 4 holes, different values of capacitors can be mounted.
The front:
For example: The "Save" and "AND" thing looks like this:
FlipFlop brd
A clipping from the output, generated by my RNG:
random numbers
Looks quite random
Such a 16 bit random number generator, produces a lot of numbers. They are parallel and very useful. Because a 100% real random number could be "0000 0000 0000 0001" all day long, but this would be useless for programming.
Last but not least: The coin flipping or rolling of dice, are not really random too. They are like my generator, the result could be anticipated. The cosmic noise could "not" be expected. (By humans on earth)