Jump to navigation Jump to search
└───liblfds710 ├───inc │ └───liblfds710 │ lfds710_prng.h └───src └───lfds710_stack lfds710_prng_init.c
void lfds710_prng_init_valid_on_current_logical_core( struct lfds710_prng_state *ps, lfds710_pal_uint_t seed );
struct lfds710_prng_state *ps
- A pointer to a user-allocated LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct lfds710_prng_state. Stack declared variables will automatically be correctly aligned by the compiler, due to the information in the structure definitions; nothing has to be done. Heap allocated variables however will by no means be correctly aligned and an aligned malloc must be used.
- A value used to generate the starting index into the sequence of numbers generated by the PRNG. This is not a literal index, but rather is a first input into the PRNG function. It can be any value in its range (i.e. including zero, a value not permitted by some classes of PRNGs).
As the function name indicates, the initialization work performed on the freelist state is only valid on the current logical core. To make this work valid on other logical cores, threads on other cores must call LFDS710_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE.
The convenience define LFDS710_PRNG_SEED is provided for use as a seed value.