[vox-tech] random number question
Jeff Newmiller
vox-tech@lists.lugod.org
Wed, 15 May 2002 11:23:04 -0700 (PDT)
On Wed, 15 May 2002, Peter Jay Salzman wrote:
> thanks jeff!
>
> begin Jeff Newmiller <jdnewmil@dcn.davis.ca.us>
> > 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 forgot about srandom/random. the man pages say that rand/srand are
> ISO C'isms and random/srandom are BSD'isms.
>
> have you read anything that claims one set is better than the other?
That would be an implementation-dependent comparison. In this case, the
man page for rand indicates that GNU implements rand using random.
As for trusting any library, anyone serious about publishing monte-carlo
simulation code implements their own random number generators, because
implementation quality does vary a lot. Numerical Recipes contains some
useful cookbook code. I have a copy if you want to look at
it.
Note that the issues Mike raises with regard to "randomness" vs.
"pseudo-randomness" are important, but not in this context.
Cryptographically, randomness is most important, but in simulation,
psuedo-randomness (so that you can repeat a simulation if desired) is
almost universally preferred.
---------------------------------------------------------------------------
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
---------------------------------------------------------------------------