Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can 'gen_range' be made public? #326

Open
LAC-Tech opened this issue Nov 12, 2024 · 0 comments
Open

Can 'gen_range' be made public? #326

LAC-Tech opened this issue Nov 12, 2024 · 0 comments

Comments

@LAC-Tech
Copy link

LAC-Tech commented Nov 12, 2024

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()
    }
@LAC-Tech LAC-Tech changed the title Can 'ren_range' be made public? Can 'gen_range' be made public? Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant