Gets a high-quality 8-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (Using a 32-bits state)
call cpct_getRandom_mxor_u8_asm
<u8> | Next 8-bits pseudo-random value. |
This function uses cpct_nextRandom_mxor_u32 to produce a stream of pseudo-random 32-bits numbers, and use them as groups of 4 8-bits values. Then, it returns each one of the last 4 8-bit values produced before calling cpct_nextRandom_mxor_u32 again. It uses cpct_mxor32_seed as storage buffer for the last 4 pseudo-random values got from cpct_nextRandom_mxor_u32.
As cpct_nextRandom_mxor_u32 produces (2^32)-1 32-bits numbers without repetition, this function will produce (2^34)-1 8-bits values without repetition.
This function uses Marsaglia’s XOR-shift standard algorithm with a concrete shift tuple. Check cpct_nextRandom_mxor_u32 to know details on how this is produced.
AF, BC, DE, HL
76 bytes divided in,
Case | microSecs (us) | CPU Cycles ----------------------------------------- available | 23 | 92 production | 88 | 352 ----------------------------------------- average-4 | 39,25 | 157 -----------------------------------------
Contains the 32-bits seed for Marsaglia’s XOR-shift random number generator.
_cpct_mxor32_seed:: .dw #0x1A7B, #0x59F2