pub fn random_partition_buf<'a, R: MutRandState>(
rng: &mut R,
total: usize,
number_of_parts: usize,
buf: &'a mut [usize],
) -> &'a mut [usize]
Expand description
Generates a random partition of total
into number_of_parts
writing the result into the provided buffer.
§Returns
A slice into the input buffer now containing a random partition with elements ordered in descending order.
§Arguments
rng
- the random number generator usedtotal
- the number being partitionednumber_of_parts
- how many pieces the partition should havebuf
- a buffer with at least enough space fornumber_of_parts
integers that the returned values are written into.