Skip to main content

split_vector_randomly

Function split_vector_randomly 

Source
pub fn split_vector_randomly<T>(
    vec: &[T],
    x: usize,
    seed: u64,
) -> (Vec<T>, Vec<T>)
where T: Clone,
Expand description

Split a vector randomly into two chunks

Splits a vector randomly into two of [..x] and the other [x..]

§Params

  • vec - Slice of the vector you want to split
  • x - Length of the first vector; the rest will be put into the second vector
  • seed - Seed for reproducibility

§Returns

A tuple of the pieces of the vector