aboutsummaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-02-03 00:31:36 +0000
committergingerBill <bill@gingerbill.org>2022-02-03 00:31:36 +0000
commitdf8bdac33f9c8333db64516f27b3c2b727ff7d2b (patch)
treead2b3011312e52fc7c1cd5c17f6fcd14a2bb6cb0 /core/math
parentb4f7a527c25ed10800948c294c9ecdae83d41c17 (diff)
Initialize the `global_rand` with the `intrinsics.read_cycle_counter()` value
Diffstat (limited to 'core/math')
-rw-r--r--core/math/rand/rand.odin6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/math/rand/rand.odin b/core/math/rand/rand.odin
index 29254d8f4..19e475835 100644
--- a/core/math/rand/rand.odin
+++ b/core/math/rand/rand.odin
@@ -1,5 +1,7 @@
package rand
+import "core:intrinsics"
+
Rand :: struct {
state: u64,
inc: u64,
@@ -7,9 +9,7 @@ Rand :: struct {
@(private)
-_GLOBAL_SEED_DATA := 1234567890
-@(private)
-global_rand := create(u64(uintptr(&_GLOBAL_SEED_DATA)))
+global_rand := create(u64(intrinsics.read_cycle_counter()))
set_global_seed :: proc(seed: u64) {
init(&global_rand, seed)