Pages: [1]   Go Down
Author Topic: True Random Number library  (Read 3111 times)
0 Members and 1 Guest are viewing this topic.
Southend / London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Author of Auduino, TrueRandom, Optiboot
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tinker.it! have just released a true random number library for Arduino: TrueRandom.

It generates true random numbers, not pseudo-random numbers. So its ideal for generating unique ID numbers or MAC addresses, gaming or cryptography.

Launch of TrueRandom: http://tinker.it/now/2010/03/16/more-random-than-random/

TrueRandom on Google Code: http://code.google.com/p/tinkerit/wiki/TrueRandom
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 362
Posts: 17306
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That looks very nice!

Any reason for not supporting the Mega AVR1280 chip, seems it would only require some if defined statements, etc? As I own multiple Arduino boards I like to use stuff portable to all the Arduino IDE supported chips.

Also any benchmark on how many random numbers a second the library can supply, i.e. what is the speed and code size hit over the standard Arduino pseudo-random number generator?

Also any testing of the generated numbers against a random number evaluator program?

Lefty
Logged

Southend / London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Author of Auduino, TrueRandom, Optiboot
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

TrueRandom doesn't support the Mega1280 yet purely due to time constraints. I hope to have 1280 support for the next release.

As for benchmarks- check out the included Benchmark example. Expect about 100 random numbers per second, or 1000 per second for coin flips (TrueRandom.random(2)).

If you need faster numbers, you can use TrueRandom to seed the pseudorandom number generator - there is an example for that too.

No testing with random number quality tests yet- but that is purely a time issue. Hopefully I can get some tests done for version 2.

Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 362
Posts: 17306
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool, I will be sure to follow your progress.

Lefty
Logged

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3499
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks nice, but did you test it? I once tested random number generators with the diehard test suite http://en.wikipedia.org/wiki/Diehard_tests. What I found was that all tested random number generators were flawed. This included random number generators from the text book as well as one certified random number generator. Certified means my company paid real money to an math professor with expertise in this field to check it.

We then switched to the Mersenne Twister.

Since then I do not trust any implementation any more unless I am told how it was tested.

Today I would test them using dieharder: http://www.phy.duke.edu/~rgb/General/dieharder.php

Did you run any such tests on your "true" random number generator?

Udo
Logged

Check out my experiments http://blog.blinkenlight.net

Southend / London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Author of Auduino, TrueRandom, Optiboot
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Udo: No, as I have already stated, no random number tests yet. Yes, you should regard it with suspicion for crypto and gaming applications until testing is complete. You have access to the library though, so by all means test it yourself. It looks like Diehard needs some big data sets though. I'd also suggest having a look at the random.org tests: http://www.random.org/analysis/ , as they seem to prefer the more actively maintained NIST tests: http://csrc.nist.gov/groups/ST/toolkit/rng/index.html

However, in its current state, it is still very useful for unique identifiers, discriminating different Arduinos with identical software, and of course amusement purposes such as die rolls and magic 8 balls.
« Last Edit: March 16, 2010, 03:42:22 pm by Cathedrow » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13072
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why do you apply the Von Neumann algorithm twice?
Logged

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3499
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oops, sorry, I missed the answer to retrolefty.
Logged

Check out my experiments http://blog.blinkenlight.net

Southend / London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Author of Auduino, TrueRandom, Optiboot
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Von Neumann corrects for a static bit bias (eg. 00000000). However it doesn't correct for oscillating bit bias (eg. 01010101). As electrical noise could influence the original measurement, and some of that electrical noise includes binary counters, it seemed prudent to add that extra layer.

I'm sure once proper random number testing is running it will assist in determining exactly how much of which type of whitening to use.
Logged

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3499
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep, you need to test. And you should test at least under three different conditions:

1) Battery powered
2) USB powered
3) AC adapter powered

It might happen that you get suprisingly different results.

Udo
« Last Edit: March 16, 2010, 04:09:39 pm by udoklein » Logged

Check out my experiments http://blog.blinkenlight.net

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone tried to make the code changes to allow this to work with the Mega?
Logged

Pages: [1]   Go Up
Jump to: