diff options
Diffstat (limited to 'core/math')
| -rw-r--r-- | core/math/rand/system_js.odin | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/math/rand/system_js.odin b/core/math/rand/system_js.odin new file mode 100644 index 000000000..b9b71c4a6 --- /dev/null +++ b/core/math/rand/system_js.odin @@ -0,0 +1,14 @@ +package rand + +foreign import "odin_env" +foreign odin_env { + @(link_name = "rand_bytes") + env_rand_bytes :: proc "contextless" (buf: []byte) --- +} + +@(require_results) +_system_random :: proc() -> u64 { + buf: [8]u8 + env_rand_bytes(buf[:]) + return transmute(u64)buf +} |