Random number generators discussion

Random number generators | www.agner.org

 
thread Combining Random number generators - Mike Babigian - 2016-02-21
last reply Combining Random number generators - Agner - 2016-02-22
 
Combining Random number generators
Author:  Date: 2016-02-21 22:42
In your example for combining two random number generators (SFMT & Mother-of-All) you suggest adding the two numbers then taking the modulo 2^b of the sum. Why not just XOR the two numbers? Is there something inherently dangerous using XOR? I ask only for the simple reason that an XOR is computationally faster.

Do you have any thoughts pro or con on Xorshift1024* (See xorshift.di.unimi.it/) and any issues combining it with Mother-of-All and/or WELL44497 (See www.iro.umontreal.ca/~panneton/well/WELLRNG44497V2.c)

Thanks in advance,
Mike

   
Combining Random number generators
Author: Agner Date: 2016-02-22 05:56
Integer addition and XOR both take 1 clock cycle on most modern processors. They are equally fast. The modulo goes automatically and takes no extra time. I often prefer addition because the carries generate some extra diffusion from the lower bits to the higher bits.

The Xorshift1024 generator looks good. I would rather combine it with the Mother-of-all generator than with the Well generator, because the xor-shift generator and the Well generator both depend mainly on finite field algebra. You should rather combine two generators that use different principles.

For large applications with multiple threads you may want to use generators with very long cycle lengths. See my article digitalcommons.wayne.edu/jmasm/vol14/iss1/23/