diff options
| author | Damian Tarnawski <gthetarnav@gmail.com> | 2023-10-27 00:05:38 +0200 |
|---|---|---|
| committer | Damian Tarnawski <gthetarnav@gmail.com> | 2023-10-27 00:05:38 +0200 |
| commit | 11a2b2a9421ddf3bb397603120db3222d9eef142 (patch) | |
| tree | a7ad4c5dfa5c7bb13701b05faa092bd7fd7985c3 /core/math | |
| parent | 0a492acaa16243d11cc779e7c89942e876c1dea4 (diff) | |
Add system_random and random_bytes for js target
Diffstat (limited to 'core/math')
| -rw-r--r-- | core/math/rand/system_js.odin | 11 |
1 files changed, 11 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..11e1385a2 --- /dev/null +++ b/core/math/rand/system_js.odin @@ -0,0 +1,11 @@ +package rand + +foreign import "odin_env" +foreign odin_env { + rand :: proc "contextless" () -> f64 --- +} + +@(require_results) +_system_random :: proc() -> u64 { + return u64(rand() * 0x1fffffffffffff) +} |