rs_quickcheck_util 0.2.0

some helper functions and macros to ease usage of quickcheck
Documentation
1
2
3
4
5
6
7
8
9
10
use quickcheck::{Gen, Arbitrary};

/// Uniformly shuffle a slice.
pub fn shuffle<T>(g: &mut Gen, xs: &mut [T]) {
    let n = xs.len();
    for i in 0..n {
        let with = i + usize::arbitrary(g) % (n - i);
        xs.swap(i, with);
    }
}