diff --git a/GB_random_seed.md b/GB_random_seed.md index 90c13d9..a5f2ef5 100644 --- a/GB_random_seed.md +++ b/GB_random_seed.md @@ -6,8 +6,17 @@ In `random.h` ## Description -TBD +Sets the current random seed to a specific 64-bit value, which will be used when an emulator instance is [[initialized|Instance Allocation]] or [[reset|GB_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. +`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. + +## See Also + +* [[GB_random_set_enabled]] \ No newline at end of file