From d485b9e2cd5429a91a57ff443a30a25522b7f7f0 Mon Sep 17 00:00:00 2001 From: brian cully Date: Sun, 28 Dec 2025 17:06:32 -0500 Subject: let fastrand know we're in wasm now seeds are random! --- Cargo.lock | 28 ++++++++++++++++++++++++++++ Cargo.toml | 5 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 0051145..7a7a605 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,22 @@ name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +dependencies = [ + "getrandom", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] [[package]] name = "js-sys" @@ -40,6 +56,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "libc" +version = "0.2.178" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" + [[package]] name = "log" version = "0.4.29" @@ -104,6 +126,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasm-bindgen" version = "0.2.106" diff --git a/Cargo.toml b/Cargo.toml index 84380f9..1d6d1f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,10 @@ crate-type = ["cdylib", "rlib"] console_log = "1.0" log = "0.4" wasm-bindgen = "0.2" -fastrand = "2.3" + +[dependencies.fastrand] +features = ["js"] +version = "2.3" [dependencies.web-sys] features = ["Document", "DocumentTimeline", "Element", "HtmlElement", "HtmlCanvasElement", "CanvasRenderingContext2d", "Node", "Window"] -- cgit v1.3