Skip to main content

get_bound_random_buffer

Function get_bound_random_buffer 

Source
pub fn get_bound_random_buffer(buffer: &mut [u32], max: u32)
Expand description

Port of void get_bound_random_buffer(uint32_t *buffer, size_t count, uint32_t max) from Src/Modules/random.c:104. Lemire (2016) fast-random-shuffling: multiply, threshold = -max % max, rejection- sample only the rare leftover < max slot. count is folded into buffer.len() per Rust idiom. WARNING: param names don’t match C — Rust=(buffer, max) vs C=(buffer, count, max)