* * PMMMLCG - Prime Modulus M Multiplicative Linear Congruential Generator * * Modified version of the Random number generator proposed by * * Park & Miller in "Random Number Generators: Good Ones Are Hard to Find" * * CACM October 1988, Vol 31, No. 10 * * - Modifications proposed by Park to provide better statistical * * properties (i.e. more "random" - less correlation between sets of * * generated numbers * * - generator is of the form * * x = ( x * A) % M * * - Choice of A & M can radically modify the properties of the generator * * the current values were chosen after followup work to the original * * paper mentioned above. * * - The generator has a period of 0x3fffffff with numbers generated in * * the range of 0 < x < M * * - The generator can run on any machine with a 32-bit integer, without * * overflow. *
Success: ?- frandom(F1), frandom(F2). F1 = 0.900086582 F2 = 0.0795856342 yes. ?- seed(1), frandom(F). F = 2.2477936e-05 yes. ?- seed(1), frandom(F). F = 2.2477936e-05 yes. Fail: frandom(123.45). Error: frandom(1234). (Error 5).