mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Initialize the global_rand with the intrinsics.read_cycle_counter() value
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package rand
|
package rand
|
||||||
|
|
||||||
|
import "core:intrinsics"
|
||||||
|
|
||||||
Rand :: struct {
|
Rand :: struct {
|
||||||
state: u64,
|
state: u64,
|
||||||
inc: u64,
|
inc: u64,
|
||||||
@@ -7,9 +9,7 @@ Rand :: struct {
|
|||||||
|
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
_GLOBAL_SEED_DATA := 1234567890
|
global_rand := create(u64(intrinsics.read_cycle_counter()))
|
||||||
@(private)
|
|
||||||
global_rand := create(u64(uintptr(&_GLOBAL_SEED_DATA)))
|
|
||||||
|
|
||||||
set_global_seed :: proc(seed: u64) {
|
set_global_seed :: proc(seed: u64) {
|
||||||
init(&global_rand, seed)
|
init(&global_rand, seed)
|
||||||
|
|||||||
Reference in New Issue
Block a user