Add system_random and random_bytes for js target

This commit is contained in:
Damian Tarnawski
2023-10-27 00:05:38 +02:00
parent 0a492acaa1
commit 11a2b2a942
4 changed files with 39 additions and 2 deletions
+11
View File
@@ -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)
}