Re: [LINK] Faster RNG

From: George (greerga@CIRCLEMUD.ORG)
Date: 07/10/98


On 10 Jul 1998, d. hall wrote:

>A random number generator shouldn't be easy to read nor understand.

International Obfuscated C Contest Entrant?

>It so be esoteric, voodoo source, for the simple reason that unless you've
>got a serious math background, and wish to play intensively with
>Stochastic methods, and have no idea what monto carlo is, you've got no
>business playing with a random number's algorithm.

        for (kk=0;kk<N-M;kk++) {
            y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
            mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
        }

I'm quite happy with the simple allocater we currently have instead of that
jumbled mess, no matter how much faster it is supposed to be.

>The reason for the original random inclusion was to offset a bad random
>function often found within native libraries.

Yes, and the problem has been solved with circle_random.

>You should be less worried about a random number's pure speed within 1
>million iterations over the fact that it truly as pseudo-random as
>possible.  A purist in algorithms can respect that.

If you're that purist, just read from /dev/random and forget your own
allocator.  That's cryptologically secure and fast in randomness, at least
in Linux. There's a huge comment in linux/drivers/char/random.c that is
good reading.

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://patches.van.ml.org/          | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST