Skip to content

Update to rand 0.9#125

Open
Jengamon wants to merge 1 commit intokyren:masterfrom
Jengamon:update-to-rand-0.9
Open

Update to rand 0.9#125
Jengamon wants to merge 1 commit intokyren:masterfrom
Jengamon:update-to-rand-0.9

Conversation

@Jengamon
Copy link
Contributor

Bump code to use rand 0.9 by translating API calls:

  • gen* -> random*
  • from_entropy -> from_os_rng

@Aeledfyr
Copy link
Collaborator

We may want to make rand optional, or directly expose RNG seeding through the API before upgrading to rand 0.9; that bumps getrandom to 0.3, which is more difficult to get working on WASM. (getrandom is an annoyingly painful dependency to manage.)

It should be straightforward to split load_random (and load_math) into variants that initialize from a seed and variants that use OS apis, and put the ones that require getrandom behind a feature flag. I may go and fix that at some point when I have time, but until then I'm personally stuck on rand 0.8.

@Jengamon
Copy link
Contributor Author

Would making the rng an argument be a path we'd want to go down?

Different applications might want different random number properties, and then we could turn off all default features, and have a feature that provides the old load_math interface with os-seeded rng.

@Jengamon
Copy link
Contributor Author

Jengamon commented Jul 18, 2025

We may want to make rand optional, or directly expose RNG seeding through the API before upgrading to rand 0.9; that bumps getrandom to 0.3, which is more difficult to get working on WASM. (getrandom is an annoyingly painful dependency to manage.)

It should be straightforward to split load_random (and load_math) into variants that initialize from a seed and variants that use OS apis, and put the ones that require getrandom behind a feature flag. I may go and fix that at some point when I have time, but until then I'm personally stuck on rand 0.8.

I haven't been having too many problems after sticking

[target.wasm32-unknown-unknown]
rustflags = '--cfg getrandom_backend="wasm_js"'

into .cargo/config.toml relative to the crate I want to compile for wasm (along with the feature addition in Cargo.toml)

EDIT: they tell you this on the crate docs page ignore me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants