Skip to content

Using a self-seeded RNG on wasm32-unknown-unknown #1249

@golddranks

Description

@golddranks

Compile issue

Problem: There should be a way to use rand without system/environment dependencies.

Quick solution: Roll my own algorithm with multiplications, modulos and bitshifts. (It did the job but not too well.)

Details: As the README says, "The WASM target wasm32-unknown-unknown is not automatically supported". However, for things like simulation purposes, self-seeded RNGs are warranted, and as the rust-random project has a bunch of well-vetted, well-documented random algorithms plus a lot of supporting APIs, it would be great if there was a well-documented way to use them on wasm32-unknown-unknown and in other context that can't assume anything about the environment. Currently the documentation assumes that you want to get system-seeded random numbers with getrandom, which isn't necessarily true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions