Restores internal index state of Marsaglia’s XORShift 8-bits generator.
void cpct_restoreState_mxor_u8 ();
call cpct_restoreState_mxor_u8_asm
Restores internal index counter of cpct_getRandom_mxor_u8 to its initial value (1). This ensures that next call to cpct_getRandom_mxor_u8 will produce 32 new random bits. Therefore, user will be sure that next value returned by cpct_getRandom_mxor_u8 is both pseudo-random generated and predictable (knowing the seed that generates it).
Internal index counter of cpct_getRandom_mxor_u8 is a counter that goes from 4 to 0. Each time counter gets to 0, cpct_nextRandom_mxor_u32 is called to produce 32 new pseudo-random bits. If counter is not 0, next group of 8-bits from the last 32 pseudo-random bits is returned, using counter as index. Therefore, setting this index counter to 1 ensures that next call to cpct_getRandom_mxor_u8 will produce a call to cpct_nextRandom_mxor_u32, obtaining 32 new pseudo-random bits. This is what this function does.
It is recommended to call this function after cpct_setSeed_mxor to get a proper pseudo-random 8-bits sequence.
A
6 bytes +37 bytes of cpct_getRandom_mxor_u8
Case | microSecs (us) | CPU Cycles ----------------------------------------- any | 9 | 36 -----------------------------------------