|
On 3/22/14, 2:49 PM, Luiz Henrique de Figueiredo wrote:
double taus88() { /* Generates numbers between 0 and 1. */ b = (((s1 << 13) ^ s1) >> 19); s1 = (((s1 & 4294967294UL) << 12) ^ b); b = (((s2 << 2) ^ s2) >> 25); s2 = (((s2 & 4294967288UL) << 4) ^ b); b = (((s3 << 3) ^ s3) >> 11); s3 = (((s3 & 4294967280UL) << 17) ^ b); return ((s1 ^ s2 ^ s3) * 2.3283064365e-10); }
Although not the same, this is similar to the RNG used in luajit: http://repo.or.cz/w/luajit-2.0.git/blob/HEAD:/src/lib_math.c#l103 --Patrick