On Jun 11, 11:08 am, rahul <(EMail Removed)> wrote:
> On Jun 11, 12:17 am, "Adem24" <(EMail Removed)>
> wrote:
> > I need a good and fast random number generator (RNG), and a
> > linear congruential generator (LCG), both with a max period
> > >= 31 bits; the bigger the better.
> > Additional requirements:
> >  Must use [unsigned] integervalues only (32 or 64 bit), no floating point.
> >  The RNG should have passed some statistical tests.
> >  The "RAND_MAX" of these generators should equal the period.
> >  The LCG should of course generate each number only once in a period.
> >  The period of the LCG should easily be changable programmatically
> > for at least any n of 2^n upto the max possible n.
> >  They must be written in C or C++.
> > Which RNG and LCG can you recommend which satisfy these requirements?
> /dev/random is considered Cryptographically Secure
> PseduoRandom number generator. But I am not aware of its
> period. And you don't have the source code for it. Its
> implemented in kernel and you will have to manually browse
> through the code to get the algorithm. It uses the noise from
> the device drivers.
/dev/random is only available on some Unix systems, and it is
not (normally, at least) a pseudorandom generator, but rather
provides access to a truly random source. It can also be
painfully slow, since it must wait for sufficient entropy; it's
very useful for getting a random number to seed an RNG, but it's
probably too slow for any extended use.
The original posting is crossposted to both comp.lang.c and
comp.lang.c++, so I don't know which language the original
poster usesif it's C++, Boost has a large collection of
random number generators (which will be incorporated into the
next version of the standard).

James Kanze (GABI Software) email:(EMail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.Cyrl'École, France, +33 (0)1 30 23 00 34
