Back to class index | LCG::SeedSyntaxvoid LCG::Seed(u32 seed, u32 multiplier=69621, u32 increment=0, u32 modulus=0x7FFFFFFF); [15 lines of code]Reinitializes the generator to the new settings. If you want to give different parameters for the generator, you should remember that: modulus should be prime modulus, increment and the multiplier should all be relative primes (increment can be 0) modulus should be greater than multiplier and increment
Most often you can leave increment = 0. A list of widely used values: Park and Miller (Minimal standard): mul = 16807 (7^5) mod = 2^31 - 1 (2147483647 == 0x7FFFFFFF) Park and Miller #2: mul = 48271 mod = 2^31 - 1 Park and Miller #3: mul = 69621 mod = 2^31 - 1 SIMSCRIPT: mul = 630360016 mod = 2^31 - 1 URN12: mul = 452807053 mod = 2^31
Infamous examples (Don't use!): |