cr8r_prng Struct Reference

A PseudoRandom Number Generator. More...

#include <prand.h>

Data Fields

uint64_t state_size
 Size of the state information for the implementation, in bytes.
 
uint32_t(* get_u32 )(void *)
 Callback to get 4 unsigned bytes from the underlying generator.
 
bool(* fixup_state )(void *)
 Called after "randomizing" the state. More...
 
char state []
 flexible length array so that the generator's state can be stored in the same allocation
 

Detailed Description

A PseudoRandom Number Generator.

This is a generic representation, generally to be heap-allocated by one of the functions in this file. That means the prng state is stored in the flexible length array in the same allocation, decreasing memory fragmentation and making copying prng state easier.

Definition at line 105 of file prand.h.

Field Documentation

◆ fixup_state

bool(* cr8r_prng::fixup_state) (void *)

Called after "randomizing" the state.

Typically the state is initialized using splitmix and then this function is called to ensure it is good.

Definition at line 113 of file prand.h.


The documentation for this struct was generated from the following file: