martes, 23 de marzo de 2010

More random than random () 17:30 19/03/2010, Collin Cunningham, MAKE: Blog

More random than random () 17:30 19/03/2010, Collin Cunningham, MAKE: Blog


The Arduino random () can be used to easily generate a seemingly unpredictable series of numbers. The only problem is, since the first time it is used in a random pattern () actually starts to spit out the same series of seemingly random numbers. The standard solution to this puzzle is to start (or "seeds") formula with a noise reading taken from an unused analog pin as follows: randoms (analogRead (0)), but for some of the data returned by the little trick may still not be enough to random, and therefore created an extra Tinker.it randomabration randomy name TrueRandom --

It is difficult to obtain a truly random number of Arduino. TrueRandom does so by creating a noise voltage on pin Devices 0, measured, and discarding all but the least significant bit of reading. But that is not loud enough, so von Neumann algorithm gathers enough entropy whitening from multiple readings to ensure a fair distribution of 1s and 0s.
And if one is left wondering what all that is good for the chance, I think - games, cryptography, generating serial numbers and the like. Swing by the TrueRandom repository to download the library.

Read more | Permalink | Comments | Digg this!

No hay comentarios:

Publicar un comentario