Réf. : Re: [LC++]Random numbers
David Filion
filioda at videotron.com
Sat Sep 1 02:20:06 UTC 2001
If you know your going to be running on a Linux system, you could read from
/dev/urandom.
You might also want to look at lrand48(). (I'm not sure if it exists in c++
though).
Grzegorz Mazur <mazur at chemia.uj.edu.pl> on 2001-08-31 09:44:27
Veuillez répondre à tuxcpprogramming at lists.linux.org.au
Pour : "Linux C++ Programming List" <tuxcpprogramming at lists.linux.org.au>
cc : (ccc : David Filion/VSI/GVL)
Objet : Re: [LC++]Random numbers
-------------- next part --------------
Hi,
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.
Cheers,
Grzesiek
_______________________________________________
This is the Linux C++ Programming List
: http://lists.linux.org.au/listinfo/tuxcpprogramming List
More information about the tuxCPProgramming
mailing list