RAND - generate pseudo-random numbers.

Usage:

B:
   srand( seed );
   value = rand();
/* C users see "expl c lib rand" */

Description:

RAND returns a random number between 0 and 2**35-1. The "seed" value for the sequence of pseudo-random numbers is set by a call to SRAND with the new seed. There is a default seed (of one) which 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.

The least significant bits of the number are not very random, so if you need a small random number, you should shift down the higher order bits rather than just ANDing off some of the low order bits.

The C version of "rand" is identical to the B RAND.

Copyright © 1996, Thinkage Ltd.