bits generated by reading voltage on every call?

3 views
Skip to first unread message

pgdeveloper

unread,
Jun 22, 2010, 7:39:18 AM6/22/10
to TrueRandom
Hello,

I notice the phrase:

"You get a random number. Really random. Different every time you
restart."

Does this mean that the voltage read is only done at startup (or on
the first call to a TrueRandom function)?

I guess my question really is: Do subsequent TrueRandom calls (like
inside a loop) re-read voltages and generate bits on every TrueRandom
function call? ...or is the voltage reading only done at startup?

Thank you!

Peter Knight

unread,
Jun 22, 2010, 8:01:47 AM6/22/10
to TrueRandom
To clarify:

All TrueRandom calls re-read voltages and generate bits on every
TrueRandom function call.

Because of this, TrueRandom is much slower than the normal Arduino
random routines. You can use TrueRandom to initially seed the Arduino
routines to get more speed at the expense of cryptographic level
randomness - but it is good enough for most purposes. See the
SetRandomSeed example.

pgdeveloper

unread,
Jun 22, 2010, 6:15:36 PM6/22/10
to TrueRandom
Great! Thank you for responding. This is the behavior I was hoping
for. I can live with the speed. One more question. I have code that
is generating 10 random numbers in a row using 'TrueRandom.random()'.
I have a PC app that requests random numbers and I generate 10 and
send them to the app all at once. I do 10 to mitigate speed issues
when communicating with the board. My app is getting sets of 10 from
TrueRandom at a pretty good clip, probably about as fast as the
interface can go. I *am* seeing an uncanny amount of duplicate
numbers. The stats (roughly) are: about every half hour I'm
generating 40,000 - 50,000 random numbers (generated and passed in
sets of 10 to the PC app, so about 4000-5000 sets of 10 are being
passed every half hour-ish). Out of this 40,000-50,000 numbers, I'm
getting about 50 every half hour that are duplicated (from previously
passed numbers in the last 10-20 minutes of operating). I'm no
statistics major, but this seemed quite high to me...no?

Is there a better way that I should be generating these sets of 10 (in
the arduino code) other than a 'for' loop where TrueRandom.random()
gets called 10 times in a row?

Again, THANK YOU so much!
> > function call?  ...or is the voltage reading only done at startup?- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages