Newsgroups: sci.stat.math
Followup-To: sci.stat.math
From: Steven Fuerst <svfue...@gmail.com>
Date: Wed, 01 Jul 2009 17:01:03 -0700
Local: Thurs, Jul 2 2009 10:01 am
Subject: New fast PRNG
Hello,
After a bit of experimenting, I've developed a new random number generator that is quite fast. I've tested it against diehard, dieharder and testu01, and it passes all tests. (Except for the broken ones in dieharder which fail all good generators.) The generator has 2^128 bits of state, and a period of 2^128. However, in This means that equivalently, you can think of this generator as having a The generator is based on a 128bit counter that is incremented by an odd This generator will produce 2^64 instances of each number from 0 to 2^64-1 Since 128 bit integers are non-standard, I provide three implementations The asm implementation takes 4.2s to generate 10^9 64bit random numbers. The constant chosen below was found after a hill-climbing search for a hash This generator seems to be ideal for Monte-Carlo applications which require Steven #define GCC_ASM static u64b rng(u64b *s) u64b c = 7319936632422683419ULL; /* Try to increment 128bit counter using adc instruction */ ((union u128_64 *)&s[0])->val += c + ((u128b) c << 64); /* Hash result */ return z + s[0]; asm volatile( #endif } static u64b seed[2]; /* Sample usage */ /* Initialize seed */ /* Get a random 64bit integer */ /* Get another random 64bit integer */ }
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||