mirror of https://github.com/LIJI32/SameBoy.git
Updated GB_random_seed (markdown)
parent
4e636ad4e7
commit
6368d41c67
|
@ -6,8 +6,17 @@ In `random.h`
|
||||||
|
|
||||||
## Description
|
## 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
|
## 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]]
|
Loading…
Reference in New Issue