Skip to content

Can 'gen_range' be made public? #326

Description

@LAC-Tech

Trying to write a fast arbitrary for a jagged vector, where I don't have to allocate N times.

After seeing how arbitrary is done for vec, it'd be useful to be able to riff on that code:

    fn arbitrary(g: &mut Gen) -> Vec<A> {
        let size = {
            let s = g.size();
            g.gen_range(0..s)
        };
        (0..size).map(|_| A::arbitrary(g)).collect()
    }

Activity

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

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