rand31_init

Description

XCSB has a 16 bit and a 31 bit psuedo random number generator. Both generators use a shift register with xor feedback. The sequence of generated numbers does not repeat within 65,535 shifts for the 16 bit generator and 2,147,483,647 shifts for the 31 bit generator.

This function initialises the 31 bit pseudo random number generator to a specific point in the sequence. By using the same seed, the same sequence of numbers will be returned. This is important when debugging code since it allows the user to consistantly produce the same set of conditions that lead to a fault in his code.

Using a seed of 0 will cause the rand31 function to always return 0

Definition

rand31_init(ulong seed)

Library

LIB/rand_lib.bas

Usage

On entry:
seed is the initial value of the random number generator. This is not the first number returned. If this value is 0, the random number generator will always return 0
On exit:
There is no return value