mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Add system_random and random_bytes for js target
This commit is contained in:
Vendored
+6
@@ -1349,6 +1349,12 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) {
|
||||
ln: Math.log,
|
||||
exp: Math.exp,
|
||||
ldexp: (x, exp) => x * Math.pow(2, exp),
|
||||
|
||||
rand: Math.random,
|
||||
rand_bytes: (ptr, len) => {
|
||||
const view = new Uint8Array(wasm_memory.buffer, ptr, len)
|
||||
crypto.getRandomValues(view)
|
||||
},
|
||||
},
|
||||
"odin_dom": {
|
||||
init_event_raw: (ep) => {
|
||||
|
||||
Reference in New Issue
Block a user