Re: need a good implementation of pseudorandom generators




nikhilbhargav_nsit@xxxxxxxxxxxxx wrote:
I have
to perform a large number of simulations for it and require a good
pseudorandom generator for it.
I am currently using a suimple implementation based on rand() function.
But if i run the simulation 100 times then on all 100 times it gives
the same set of random values.
In many languages, you need to call a procedure named "randomize"
at the beginning of the program to initialize the random number
generator to a new seed, and thereby get a different sequence of
random values out. Sounds like you haven't done that.

This won't necessarily give you high quality random numbers though--
that depends on the nature of the built-in rand function. If you want
to
code your own, there are several good generator algorithms around.
Mersenne Twister is one that is used a lot, and George Marsaglia has
developed a few. Alternatively, your program could read in previously
generated random numbers from a file; there are several sources
of those.

.



Relevant Pages

  • Re: Matlabs random number generator is suspicious... what to do?
    ... results, and did not bother to reinitialize the random number generator, you ... Just because MATLAB by default ... Carlo simulations perform. ... The cause of this as of yet unknown problem has to ...
    (comp.soft-sys.matlab)
  • Re: /dev/random not generating random data
    ... >stdlib is not good enough for whatever purpose you have. ... simulations or other simulations in which what you want is some flat ... For cryptography it is a different story. ... >CPUs) have a hardware random number generator which uses thermal noise. ...
    (alt.os.linux)
  • RE: SHA-based subclass for random module
    ... other simulations may not care at all. ... If you're only using one PRNG, ... Pass your base generator to the Shuffle constructor, ...
    (comp.lang.python)