Skip to content

SmallRng algorithm #603

@dhardy

Description

@dhardy

This type is introduced as follows:

An RNG recommended when small state, cheap initialization and good
performance are required. The PRNG algorithm in SmallRng is chosen to be
efficient on the current platform, without consideration for cryptography
or security
. The size of its state is much smaller than for StdRng.

There is general consensus that the current algorithm, Xorshift, is not an ideal choice due to quality (poor results in PractRand and BigCrush) and trivial predictability (to the point that seeding one instance from another effectively creates a clone). Ideally we should replace this for the 0.6 release.

Existing work:


I'm creating this new issue for visibility (most of the previous discussions happened on a fork) and to refresh this issue.

(First note: "reproducible" is used here to mean deterministic, portable, and a commitment not to tweak the algorithm in future updates. All reproducible PRNGs should eventually be migrated out of Rand proper to sub-libs, as discussed in dhardy#58 and #431.)

Question 1: is the current API with two non-reproducible PRNGs, StdRng and SmallRng, the right one? As I understand the current choice is reasonably well accepted, although there have been suggestions to add more categories of PRNG.

Question 2: which algorithm should we use for SmallRng? (The choice may vary by platform.)

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