Skip to content

Let rand::rng() use OsRng unless thread_rng is enabled? #1545

@dhardy

Description

@dhardy

ThreadRng adds some thread-local memory. In case not all users want this, we could add a thread_rng feature flag (probably default-enabled). We have a thread_rng feature in v0.9.

Where the thread_rng feature is not enabled, rand::rngs::ThreadRng would not be available. rand::rng() could instead use OsRng (assuming that getrandom is available), thus the thread_rng feature would mostly be a performance boost (at the cost of extra code and thread-local memory).

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-questionParticipation: opinions wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions