cpct_setRandomSeedUniform_u8

Sets the random seed used by cpct_getRandomUniform_u8_f.

C Definition

void cpct_setRandomSeedUniform_u8 (u8 seed) __z88dk_fastcall;

Input Parameters (1 byte)

(1B L) seedNew seed to be set for the random number generator.

Assembly call (Input parameter on L)

call cpct_setRandomSeedUniform_u8_asm

Parameter Restrictions

  • seed New seed byte that will be set internally in the random number generator.  There is no restriction about the value of this byte.

Known limitations

  • This function will not work from a ROM.  It does not specifically use self-modifying code, but indirectly modifies the code of cpct_getRandomUniform_u8_f.

Details

This function sets the random seed that cpct_getRandomUniform_u8_f uses internally for generating pseudo-random numbers.  This can be used to randomize the start of the pseudo-random sequence or to make it predictable (setting the same seed again).

Please, do read documentation from cpct_getRandomUniform_u8_f for more details about how this random generator works.

Destroyed Register values

A

Required memory

2 bytes

Time Measures

   Case     | microSecs (us) | CPU Cycles
-----------------------------------------
   Any      |       7        |    28
-----------------------------------------

Credits

Random generation original code comes from Fast RND, which can be found published by z80-info.  The original code is reported to be from Spectrum ROM.

Returns a pseudo-random byte uniformly distributed using fast method (33*Seed mod 257)
Sets the random seed used by cpct_getRandomUniform_u8_f.
unsigned char (u8 = unsigned 8-bits, 1 byte )
Close