JAL manual - libraries - random3

previous up next

The random3 library provides pseudo-random bits and bytes from a 24-bit (3 byte) linear-feedback shift register.

The shift register which generates the pseudo-random data is not automatically initialised. This might be good or bad, depending on your application. Keep in mind that the initial content of the register file will still not be very random.

   procedure randomize( byte in n )

A call to this procedure initializes the FSR bytes to the value n and performs 24 shifts. This gives you a random starting point provided that you can come up with a random byte value. When you randomize with a constant value you will always get the same (pseudo!) random sequence.

   function random_bit return bit

This function returns a (next) pseudo-random bit.

   function random_byte return byte

This function returns a (next) pseudo-random byte.


previous up next