(49G) An Inverse Congruential Pseudo 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: (49G) An Inverse Congruential Pseudo Random Number Generator (/thread-4338.html) |
(49G) An Inverse Congruential Pseudo Random Number Generator - Gerald H - 07-11-2015 07:31 AM Iset takes takes two positive integers S & P from the stack & sets the six parameters Iseed Ia Ic Im Iπ Ipow S is the size of the prime Iπ & P the power Ipow of the prime used in the formula Iseed := (Iseed ^ -1) * Ia + Ic MOD Iπ ^ Ipow Iπ ^ Ipow is used to set the size of the other parameters. Actuate IXNEXT to return the next pseudo-random integer to the stack. ISET uses one sub-programme, see below. Code:
|