Function smartnoise_runtime::components::resize::create_sampling_indices [−][src]
pub fn create_sampling_indices(
k: i64,
n: i64,
enforce_constant_time: bool
) -> Result<Vec<usize>>
Accepts size of set (n) and size of desired subset(k) and returns a uniformly drawn set of indices from [1, …, n] of size k.
This function is used to create a set of indices that can be used across multiple steps for consistent subsetting.
Arguments
k
- The size of the desired subsetn
- The size of the set from which you want to subset
Return
A vector of indices representing the subset
Example
use smartnoise_runtime::components::resize::create_sampling_indices; let subset_indices = create_sampling_indices(5, 10, false);