RenderWare V2.1

Previous Page Index Next Page

RwInt32

RwRandom(void);

Description

Generates a pseudo random number

Arguments

None.

Return Value

A pseudo random RwInt32 number. There is no error return.

Comments

RwRandom() uses a non-linear additive feedback random number generator employing a default table of size 31 long integers to return successive pseudo-random numbers in the range from 0 to (2**31)-1. The period of this random number generator is very large, approximately 16*((2**31)-1).

RwRandom() and RwSRandom() have (almost) the same calling sequence and initialization properties as rand() and srand(). The difference is that rand() produces a much less random sequence - in fact, the low dozen bits generated by rand go through a cyclic pattern. All the bits generated by RwRandom() are usable. For example,

RwRandom() & 01

will produce a random binary value.

See Also

RwSRandom()