People seem to be too paranoid about the quality of pseudo random number
generators, but why don't you just ask the experts out there?
A friend of mine pointed me to the errata list of volume two of Donald
E. Knuth's "The Art of Computer Programming". There, DEK has suggested
a very good portable random number generator. It generates 30-bit
integers with the following properties:
- they pass all tests from Marsaglia's "diehard" suite of tests
for random number generators (but read the discussion of the
interpretation of the "birthday-spacing" test)
- they can be generated with portable signed 32-bit arithmetic
- it is faster than other lagged Fibonacci generators
- it can create at least 2^30 - 2 independent sequences
(Sorry, I don't have the period length and hand, but it's fairly long.
> 2^137 ?)
It is fairly small (certainly much much smaller than the current random
number generator that is being bashed), much better and faster than say
the well-known Marsaglia-Zaman generator, and of course much much better
that the linear congruential generator that I have seen somewhere in the
networking code. I give you an arbitrary number of generated numbers,
and you tell me the seed! (Ok, its not cryptography, but still rather
good. You can even increase the number of independent sequences with
standard methods.).
I can get the source and write an interface for the kernel, if you
like. Just let me know.
-- Ciao, -ha=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Harald Anlauf | Phone: +49-6151-16-2972 (office) TH Darmstadt | +49-6151-714673 (private) Institut f. Kernphysik | Fax: +49-6151-16-2421 Schlossgartenstr. 9 | Internet: anlauf@crunch.ikp.physik.th-darmstadt.de 64289 Darmstadt | Harald.Anlauf@cern.ch Germany | anlauf@slac.stanford.edu