[vox-tech] random number question

Jeff Newmiller vox-tech@lists.lugod.org
Wed, 15 May 2002 10:09:15 -0700 (PDT)


On Wed, 15 May 2002, Peter Jay Salzman wrote:

> using the same seed will produce the same set of random numbers.

srand->rand and srandom->random behave this way.

> i assume this is NOT true across reboots?

You can assume it IS true across reboots. These are purely numerical,
deterministic algorithms.

> and i assume it's not true across different computers?

This is true, as library routines may be implemented differently in
different environments, or even from one version to the next.

If you really want repeatable random number generation, you need to pull
the algorithm into your own source.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------