Utility for random grouping.
The author of this crate is not good at English.
Forgive me if the document is hard to read.
This is useful for grouping multiple items into some groups at random.
```rust
let mut rg = RandomGrouping::new();
let samples = (0..10).collect::
let result = rg.dividebyratio(&samples, &ratios);
assert!(result.len() == ratios.len()); for i in 0..result.len() { let groupsize = (ratios[i] * samples.len() as f64).floor() as usize; assert!(result[i].len() == groupsize); assert!(result[i].iter().all(|x| samples.contains(x))); } ```
Version 0.2 has the following changes.
stable
has been changed to true
from false
.divide_by_size
and divide_by_ratio
is changed to
IntoIterator
from slice.divide_slice_by_size
and divide_slice_by_ratio
are introduced
(which are faster for slices).