Yay!!! New Arduino RNG

Here are the results of the new random number generator I built yesterday.
The old random number generator was not putting out an unbiased stream of bits.
I tried using debiasing algorithms with the old generator but it was not enough.

ent LOGGER00.CSV

Entropy is how random a piece of data is, basically how many random bits are in one byte.
True randomness is 8.0 bits per byte.
We are really close. Yay!!! Five Nines!!! Statistically Significant!!! Yay!!!
Entropy = 7.999993 bits per byte.

Basically says how small you could get it with a zip file
Zip files and pretty much all compression schemes do their job by removing patterned and repeating sequences of bits
Optimum compression would reduce the size
of this 25874432 byte file by 0 percent.

Can’t quite figure out what a good figure is on this test
but 50 percent with an average of 254.05 seems good
Chi square distribution for 25874432 samples is 254.05, and randomly
would exceed this value 50.50 percent of the times.

Do the bytes average out to be in the middle
Tests the ratio of ones to zeros in the bit stream
Arithmetic mean value of data bytes is 127.4920 (127.5 = random).

Can we calculate Pi correctly, if so, we pass. Yay for Pi!!! Yay for Pie!!!
Monte Carlo value for Pi is 3.141568568 (error 0.00 percent).

Assuming this tests byte to byte similarities
Which means is the current byte similar to the last one
Serial correlation coefficient is -0.000016 (totally uncorrelated = 0.0).

True_Random_Logger

Random class for Arduino

Logger class for Arduino

Schematic

The diode is a 12.1V zener and C1 is a ceramic disc type capacitor. The zener diode’s part number is an artefact of the designer I used so you can ignore it.

[svg src=/wp-content/uploads/2012/05/RNG2_schem.svg width=550 height=550]


Full Size

3 comments

Excellent results! I’m eagerly awaiting your links.

Do you know whether the 2N3904 transistor can be safely replaced by a 2N2222?
According to Wikipedia, it has very similar characteristics, but as a total beginner in electronics, I’m a bit doubtful.

Anyhow, thanks for your efforts you’ve put in this TRNG-project. Beautiful outcome! 🙂

You should be able to. The only difference I know of is the max collector current which is 800mA where as the 3904 is 200mA. I am not sure on the zener characteristics if you reverse bias it like in the previous posts. I used a zener diode for this one simply because I didn’t want to ruin any more transistors.

Leave a Reply