Pseudo random number generator

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:

  • You can listen to the universe (I think it’s the background noise or cosmic noise) and generate an infinite string of zeros and ones.
  • Using a bi-stable multivibrator is a bit more easier and this circuit generates a “usable” number.
  • A not so good method, is the use of an open-base or open-collector transistor. (Do not confuse with the electron/hole avalanche effect in a p-n junction used in “real” RNG’s)
  • Buying some random numbers copied to a CD on Amazon.
  • Visit a recommended site on the internet.
  • The state of mind of your boss in the morning.
  • Lava lamps.


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”.

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.

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.

Additionally, the schematic representation of my two-sided PCB:

For example: The “Save” and “&” thing looks like this:

A clipping from the output, generated by my RNG:

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)