-
-
Notifications
You must be signed in to change notification settings - Fork 217
GB_random_seed
void GB_random_seed(uint64_t seed);
In random.h
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.
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.
The seed is automatically initialized on process launch to a value based on the current time.