fn rand<R: Rng>(rng: &mut R) -> PermutationTable {
        let mut seq: Vec<u8> = (0..TABLE_SIZE).map(|x| x as u8).collect();
        rng.shuffle(&mut *seq);

        // It's unfortunate that this double-initializes the array, but Rust
        // doesn't currently provide a clean way to do this in one pass. Hopefully
        // it won't matter, as Seed creation will usually be a one-time event.
        let mut perm_table = PermutationTable { values: [0; TABLE_SIZE] };
        let seq_it = seq.iter();
        for (x, y) in perm_table.values.iter_mut().zip(seq_it) {
            *x = *y
        }
        perm_table
    }
/// Generates a PermutationTable using a random seed.
Generates a PermutationTable using a random seed.
Generates a PermutationTable using a random seed .
fn rand<R: Rng>(rng: &mut R) -> PermutationTable {
        let mut seq: Vec<u8> = (0..TABLE_SIZE).map(|x| x as u8).collect();
        rng.shuffle(&mut *seq);
        // It's unfortunate that this double-initializes the array, but Rust
        // doesn't currently provide a clean way to do this in one pass. Hopefully
        // it won't matter, as Seed creation will usually be a one-time event.
        let mut perm_table = PermutationTable { values: [0; TABLE_SIZE] };
        let seq_it = seq.iter();
        for (x, y) in perm_table.values.iter_mut().zip(seq_it) {
            *x = *y
        }
        perm_table
    }
fn rand < R : Rng > ( rng : & mut R ) -> PermutationTable { let mut seq : Vec < u8 > = ( 0 .. TABLE_SIZE ) . map ( | x | x as u8 ) . collect ( ) ; rng . shuffle ( & mut * seq ) ; // It's unfortunate that this double-initializes the array, but Rust // doesn't currently provide a clean way to do this in one pass. Hopefully // it won't matter, as Seed creation will usually be a one-time event. let mut perm_table = PermutationTable { values : [ 0 ; TABLE_SIZE ] } ; let seq_it = seq . iter ( ) ; for ( x , y ) in perm_table . values . iter_mut ( ) . zip ( seq_it ) { * x = * y } perm_table }
Generates a PermutationTable using a random seed.
Generates a PermutationTable using a random seed .
rng
&mut R