Table of Contents
Definition
void GB_random_seed(uint64_t seed);
In random.h
Description
Sets the current random seed to a specific 64-bit value, which will be used when an emulator instance is initialized or reset. This function can be used to force a newly reset or initialized emulator instance to a specific state.
Thread Safety
GB_random_seed
is thread-safe and can be called from any thread and context. However, it should be noted that the random state is global, and initializing or resetting two instances simultaneously on the same thread will not yield deterministic results even if GB_random_seed
was called with a specific seed. If this kind of determinism is critical, use a lock around calls to GB_init
, GB_reset
, and GB_switch_model_and_reset.
Notes
The seed is automatically initialized on process launch to a value based on the current time.