Main Page Compound List File List Header Files File Members

# rand.h File Reference

Random generator using the linear congruential method. More...

## Functions
|  | void | initrand (UINT16 seed) NONBANKED
|  |  | Initalise the random number generator. More...

|  | INT8 | rand (void)
|  |  | Returns a random value.

|  | UINT16 | randw (void)
|  |  | Returns a random word.

|  | void | initarand (UINT16 seed)
|  |  | Random generator using the linear lagged additive method Note that 'initarand()' calls 'initrand()' with the same seed value, and uses 'rand()' to initialize the random generator. More...

|  | INT8 | arand (void)
|  |  | Generates a random number using the linear lagged additive method.

## Detailed Description

Random generator using the linear congruential method.

Author(s):
  Luc Van den Borre

## Function Documentation

void initrand (UINT16 seed)

Initalise the random number generator.

seed needs to be different each time, else the same sequence will be generated. A good source is the DIV register.

void initarand (UINT16 seed)

Random generator using the linear lagged additive method Note that 'initarand()' calls 'initrand()' with the same seed value, and uses 'rand()' to initialize the random generator.

Author(s):
  Luc Van den Borre