Skip to content

Randomness consumption documentation #8

@meithecatte

Description

@meithecatte

Most functions do not document how they use their Seed internally. On one hand, these are irrelevant implementation details, but on the other hand, if they use Seed::next, the relationship between the two results might not be obvious. For example, consider:

    let seed = malachite::random::EXAMPLE_SEED;
    let low = Natural::from(1000_u32);
    let high = Natural::from(10000_u32);

    let xs = uniform_random_natural_range(seed, low.clone(), high.clone());
    let ys = uniform_random_natural_range(seed.next(), low, high);

In one conceivable implementation of uniform_random_natural_range, there exists an n such that xs.skip(n) and ys generate the same sequence. As far as I can tell from a quick test eyeball, this is not actually the case. This is of course an extreme example, other issues could be much more subtle.

Clearly, more documented guarantees around this are necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions