[LC++]Random numbers

Grzegorz Mazur mazur at chemia.uj.edu.pl
Sat Sep 1 02:10:05 UTC 2001


On Fri, 31 Aug 2001, Mark Phillips wrote:

> Is the comment from Numerical Recipes in C based on older versions
> of rand()?  Ie is it that the first method above (of generating
> a number between 1 and 10) used to be preferable to the second
> method, but now with improved random number generators, the
> second method is just as good --- (and quicker!)??

It seems so. But I'd say that it really depends on the C library (I mean
the std C library) you use, and in case you are doing anything serious,
you should not rely on the quality of std C library, but use one of the
available high quality (pseudo) random generator implementations. BTW,
this way you can get one that have nice C++ interface. You may take a look
at blitz, but there are some other.


More information about the tuxCPProgramming mailing list