Re: Random Numbers
On Wed, 16 Jan 2008 07:45:30 -0500, jkherciueh wrote:
>
> Linear congruence RNGs can suffer from a small period in low-order bits.
> Some are so weak that they produce even and odd results alternatingly.
> (I have, however, never seen a rand() that does that, but I then again,
> I didn't search for one either:-)
FYI, the "quick and dirty" PRNG "ranqd1" in "Numerical Recipes in C" does
this. It's a one-liner linear congruential generator which uses one
multiply and one add (32-bit unsigned int) and is thus about as fast as
it gets.
Despite the (very) weak low-order randomness, I'd hazard that it not much
worse than many system-supplied PRNGs - so long as you know what you're
dealing with and, of course you don't mod it!
--
Lionel B
|