"Scott Robert Ladd" <(E-Mail Removed)> wrote in message

news

(E-Mail Removed). ..

> On Mon, 05 Jan 2004 17:48:42 +0000, Carsten Hansen wrote:

> > The C/C++ Standard does not define rand.

>

> Yes it does; however, that is debated elsewhere in this thread.

>

> > Multiplication is not slow on today's processors. Bit shifting is on
x86.

> > The Mersenne Twister is relative slow because it does

> > four table lookups

> > five shifts

> > eight bitwise operations

> > for each number.

>

> Okay, I can write a one-line generator function that is vastly faster than

> the Mersenne Twister -- of course, it won't be a very good generator (like

> the one suggested in the C standard), but it will be fast.

>

> The "minimal standard", as suggested by Knuth and others, involve many

> operations; in general, Mersenne Twister is as faster or faster than any

> other generator that has similar statistical properties. And a whole lot

> of people seem to agree; you can find the cites in the article.

>

> Two "errors", one of which isn't and the other a platform dependence.

> Doesn't sound very "full of errors" to me. But thanks for the pointers.

>

> --

> Scott Robert Ladd

> Coyote Gulch Productions (http://www.coyotegulch.com)

> Software Invention for High-Performance Computing

>

>
Your claims about "a" and "m" in LCM, "a and m can take on only a very few

values" and "m most certainly being a prime", are false.

You claim about best LCM for 32-bit numbers is inconsistent. Is it a=16807

and m = 2147483647 or a=42871 and m=69621.

Knuth calls the first "adequate but less outstanding". Its result from the

spectral test is far below other 32-bit LCMs.

The random number generator Knuth has on his web site involves two table

lookups and one bitwise operation. Hence it is much faster than the Mersenne

Twister.

Marsaglia has many high quality random number generators involving far less

operations than the Mersenne Twister.

Here is a quote about the Mersenne Twister by Marsaglia: "But it requires an

elaborate C program and is slower than many RNGs that do as well in tests,

have comparable or longer periods and require only a few lines of code."

The Mersenne Twister claim to fame is mostly because of its cute name.

Your code show that you don't understand random number generation.

In get_rand_range you basically map [0, 4294963695] onto the range. That

cannot be done uniformly. That is part of the C FAQ.

Carsten Hansen