Generate a random boolean mask for gene selection. Creates a boolean vector where `num_random_selection` randomly chosen positions are set to `true`, and all others are `false`. This is used for benchmarking and testing purposes when you want to select a random subset of genes. ## Parameters `n_genes` - Total number of genes in the dataset `num_random_selection` - Number of genes to randomly se
(n_genes: usize, num_random_selection: usize)
| 326 | /// assert_eq!(mask.iter().filter(|&&x| x).count(), 2000); |
| 327 | /// ``` |
| 328 | fn generate_random_mask(n_genes: usize, num_random_selection: usize) -> Vec<bool> { |
| 329 | let mut rng = rng(); |
| 330 | let uniform = Uniform::new(0, n_genes).unwrap(); |
| 331 | let mut vec = vec![false; num_random_selection]; |
| 332 | for _ in 0..num_random_selection { |
| 333 | let v = uniform.sample(&mut rng); |
| 334 | vec[v] = true; |
| 335 | } |
| 336 | vec |
| 337 | } |
no outgoing calls
no test coverage detected