RAND - generate pseudo-random numbers.

Usage:

function rand : integer; extern;
...
value = rand;
procedure srand(seed : integer); extern;
...
srand(seed);

Description:

RAND returns a random number between 0 and 2**35-1 (maxint). The seed value for the string of pseudo-random numbers is set by a call to SRAND with the new seed. There is a default seed of 1 that may be used when debugging. In actual use, it may be better to use a "random" seed such as the processor time; at any rate, the seed value should be odd, so as to get the largest possible period of the generator.

Notes:

The least significant bits of the number are often not very random. So to generate a number between "0" and "n-1", you would code "rand div (maxint div n)" rather than "rand mod n".

Copyright © 1996, Thinkage Ltd.