Random

Summary
Random
Macros
Simple aliases for most common random generatorsThis macros are designed to simplify the user interface for generating random numbers.

Macros

Simple aliases for most common random generators

This macros are designed to simplify the user interface for generating random numbers.  Most of the time, a Marsaglia XOR-shift RNG is best choice for generating random numbers

cpct_rand8returns a random u8 value ( 8-bits).  It uses cpct_getRandom_mxor_u8.
cpct_rand16returns a random u16 value (16-bits).  It uses cpct_getRandom_mxor_u16.
cpct_rand32returns a random u32 value (32-bits).  It uses cpct_getRandom_mxor_u32.
cpct_srand8(SEED)Sets seed for MXOR generators (SEED = 32 bits value) and restores internal state of cpct_getRandom_mxor_u8.
cpct_srand16(SEED)Sets seed for MXOR generators (SEED = 32 bits value) and restores internal state of cpct_getRandom_mxor_u16.
cpct_randalias for cpct_rand8
cpct_srandalias for <cpct_srand8>
unsigned char (u8 = unsigned 8-bits, 1 byte )
Gets a high-quality 8-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (Using a 32-bits state)
unsigned int (u16 = unsigned 16-bits, 2 bytes)
Gets a high-quality 16-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (using a 32-bits state)
unsigned long (u32 = unsigned 32-bits, 4 bytes)
Gets a 32-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (using a 32-bits state)
returns a random u8 value ( 8-bits).
Close