(48G) 48G, 49G & 50G: Explicit Inverse Congruential Random Number Generator - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (48G) 48G, 49G & 50G: Explicit Inverse Congruential Random Number Generator (/thread-4409.html) |
(48G) 48G, 49G & 50G: Explicit Inverse Congruential Random Number Generator - Gerald H - 07-23-2015 07:21 AM An Explicit Inverse Coungruential Random Number Generator to base 2 ^WORDSIZE. SDR seeds constants a & b with suitable values to ensure maximum period & the counter j with a random value. NEXTX produces the next hexadecimal string in the sequence using the formula next := j * ( j * a + b ) ^ -1 MODULO 2 ^ WORDSIZE where j increases by 1 at each iteration. NEXTR returns the next real in the sequence, next divided by the modulus. TO USE: Set wordsize as required, actuate SDR - NEXTX or NEXTR will then return the sequence you require. I would be grateful for reports of (in-)adequacy of the randomness of sequences produced. Code:
|