Secure random number generation for MoonBit (OS entropy; native+WASM)
use moonbitlang/mb-getrandom
fn main {
match getrandom(32) {
Ok(random_bytes) => println("Random bytes generated successfully")
Err(e) => println("Error: \{e}")
}
}import { createWasmImports } from './wasm_host.js';
const wasmBytes = /* your compiled WASM */;
const imports = createWasmImports();
const wasmModule = await WebAssembly.instantiate(wasmBytes, imports);moon test --target js # Use this for web environment testingSecure random number generation for MoonBit (OS entropy; native+WASM)