Trait RandomPermutation

Source
pub trait RandomPermutation {
    type Item;

    // Required method
    fn random_permutation<Hashing: Hash>(
        self,
        random: &mut RandomNumberGenerator<Hashing>,
    ) -> Option<Vec<Self::Item>>;
}
Expand description

Pseudo-random permutation. It’s as secure as the combination of the seed with which the RandomNumberGenerator is constructed and the hash function it uses to cycle the elements.

Required Associated Types§

Required Methods§

Source

fn random_permutation<Hashing: Hash>( self, random: &mut RandomNumberGenerator<Hashing>, ) -> Option<Vec<Self::Item>>

Random permutation from an array of elements. This is guaranteed to return Some except in the case that self is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> RandomPermutation for Vec<T>

Source§

type Item = T

Source§

fn random_permutation<Hashing: Hash>( self, random: &mut RandomNumberGenerator<Hashing>, ) -> Option<Vec<T>>

Implementors§