aboutsummaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-10-31 12:16:25 +0000
committerGitHub <noreply@github.com>2023-10-31 12:16:25 +0000
commiteb261f5b28a8d3cddc3dc21441f33775bb3ced95 (patch)
tree55014f5e1ffe0c099376699945a1800cc4d16246 /core/math
parentbbd4c1054e18f18e934828b5160efce076027d1e (diff)
parentf5febb633c92ee1cf7b5d88f0146ffac3e2481b7 (diff)
Merge branch 'master' into new-sys-unix
Diffstat (limited to 'core/math')
-rw-r--r--core/math/rand/system_js.odin14
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
+}