quickcheck icon indicating copy to clipboard operation
quickcheck copied to clipboard

Can 'gen_range' be made public?

Open LAC-Tech opened this issue 1 year ago • 1 comments

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 avatar Nov 12 '24 23:11 LAC-Tech