Random Number Generation
Anyone who considers arithmetical methods of producing
random digits is, of course, in a state of sin.
|
John Von Neumann (1951)
Here is information on pseudo and quasi random number generation with
implementations in several languages. And a tutorial on how to generate
nonuniformly distributed random numbers.
Pseudo-Random number generation using R250
(Kirkpatrick and Stoll, 1981).
Note: R250 is an example of a shift register generator. This
one has a register length of 250 which results in a period of 2^249. The code
provide here can easily be modifed for other register lengths. The
following two papers
describe the parameters that are needed for lengths from 1 to 1000:
Zierler, N. and J. Brillhart,1968; On primitive trinomials (mod 2),
Information and Control, Vol 13 No 6 (Dec), pp. 541 - 554
Zierler, N. and J. Brillhart,1969; On primitive trinomials (mod 2)
II,
Information and Control, Vol 14 No 6 (Jun), pp. 566 - 569
Warning 1: R250 requires the use of a separate random number generator
in order to intialize itself. It can fail spectacularly if the initialization
is poorly done. I have had reliable results using the Park and Miller
"minimal standard" generator for the initializer. The above implementations
use this initializer (which is included in the source code).
Warning 2: R250 is not crypotographically secure (it easily cloned from its output). This is not an issue when doing physics modelling but it certainly is if your random numbers are part of
a cryptographic application.
Other generators:
Quasi-Random number generation
(Press and
Teukolsky, 1989).
Whats all the fuss about ?
Why can't I just use the PRNG that came with my compiler ?
See Also:
Everett (Skip) Carter
Taygeta Scientific Inc.
620 Charles ave., suite C
Seaside, CA. 93955
|
e-mail:skip@taygeta.com
WWW: http://www.taygeta.com/
|
Taygeta's Home page
|