Mail Archives: djgpp/1998/03/25/14:28:06
Jason Alexander wrote:
>
> Also, does anyone have an (informed) opinion on which of the two
> generators is better? (Where "better" is understood in terms of the
> theoretical and empirical tests described in Knuth vol. 2. I know all
> linear congruential generators eventually fail the spectral test, but I
> was wondering which of rand() and random() perform better.)
>
random() is known to avoid some of the problems with linear congruential
generators, such as rand(). In this respect, it can be seen as the better
one.
Note however that linear congruential algorithms are the RNG which
have been most researched. So, their flaws are better known than those of
other algorithms. A problem you may encounter when relying on different
algorithms, like that of random(), is that many of its weaknesses are
still unknown. A good point for rand() is that when you use it, you know
better where you stand.
Regards,
Francois
- Raw text -