ZF Tang wrote:
Hi, guys.
I'm compiling a c++ file in cygwin.
drand48() and srand48() are used in this file. But there is no
definition for them in stdlib.h. Can I replace them with
random()? If no, is there any other approach to solve this problem?
I'm not familiar with Unix/Linux-like environments. Any help will
be appreciate very much.
It's probably safe to say that most implementations of rand(), random()
and drand48() are deeply duff as regards the quality of random deviates
generated and often have unacceptably short "periods" (the number of
random numbers produced until the sequence repeats).
My recommendation for pseudo-random number generation would be the
well-known "Mersenne Twister" RNG. It is tried and tested, performs
well on various benchmarks of "randomness", has a very long period and
is also fast. More information and code is available at:
http://www.math.sci.hiroshima-u.ac.j...at/MT/emt.html
Regards,
--
Lionel B