Technical Notes Database TN619D.txt RANDOM RANDOMIZE - RANDOM NUMBER GENERATOR FORMULA Category :Pascal Platform :All Product :Turbo Pascal 4.0+ Description: Q. What is the formula used by the random number generator in Turbo Pascal? A. The random number generator in Turbo Pascal uses 32-bit arithmetic. It maintains a 32-bit 'seed', which is treated as an unsigned integer. Each call to Random changes the seed by the formula seed:=multiplier * seed + 1 mod 4294967296 Turbo Pascal uses the multiplier, 134775813. The modulus, 4294967296, is 2 to the power 32. The multiplier was chosen carefully for its nice randomness properties. The seed will take on every 32-bit integer before repeating. Reference: 7/16/98 4:35:34 PM
Last Modified: 01-SEP-99