mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
fix: implement generate_random_number for wasm binding
This commit is contained in:
@@ -288,8 +288,9 @@ impl limbo_core::IO for PlatformIO {
|
||||
}
|
||||
|
||||
fn generate_random_number(&self) -> i64 {
|
||||
let random_f64 = Math_random();
|
||||
(random_f64 * i64::MAX as f64) as i64
|
||||
let mut buf = [0u8; 8];
|
||||
getrandom::getrandom(&mut buf).unwrap();
|
||||
i64::from_ne_bytes(buf)
|
||||
}
|
||||
|
||||
fn get_memory_io(&self) -> Arc<limbo_core::MemoryIO> {
|
||||
@@ -297,11 +298,6 @@ impl limbo_core::IO for PlatformIO {
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
fn Math_random() -> f64;
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
type Date;
|
||||
|
||||
Reference in New Issue
Block a user