(seq: &[T])
| 17 | } |
| 18 | |
| 19 | pub fn random_select<T>(seq: &[T]) -> &T { |
| 20 | let len = seq.len(); |
| 21 | let rand_num: usize = get_global_rng().gen(); |
| 22 | let rand_num: usize = rand_num % len; |
| 23 | &seq[rand_num] |
| 24 | } |
| 25 | |
| 26 | pub fn random_sample<T: Clone>(seq: &[T], n: usize) -> Vec<&T> { |
| 27 | if seq.len() <= n { |
no test coverage detected