[A83] Re: shuffle code help please


[Prev][Next][Index][Thread]

[A83] Re: shuffle code help please




Montana Rowe writes:
> this isn't for a calc, but i was wondering if anyone had a really good
> randomalgo

Define "really good".  There are cryptographically secure generators.  These
require entropy for be certain that the numbers are truely random.
Otherwise, it is theoretically possible to predict numbers in the sequence.
For example, Linux has /dev/random and /dev/urandom.  random will always
return cryptographically secure random numbers and block until there is
entropy available.  urandom will return secure numbers while there is
entropy available and then fall back to cryptographically strong numbers.

If you just need a psuedo random number, then linear congruential generators
are a good way to go.  This is the typical algorithm used for things like
the C librarys rand() function.  The algorithm is described in Donald
Knuth's The Art of Computer Programming, Volume 2 Seminumerical Algorithms.
If you don't have access to this book, then you should be able to enough on
it with a Google search.

--
David Phillips <david@acz.org>
http://david.acz.org/




References: