lambda_platform/rand/
mod.rs1use rand::{
2 distributions::Uniform,
3 Rng,
4};
5
6#[inline(always)]
8pub fn get_random_float_between(min: f32, max: f32) -> f32 {
9 let mut rng = rand::thread_rng();
10 return rng.gen_range(min..max);
11}
12
13pub fn get_uniformly_random_floats_between(
16 min: f32,
17 max: f32,
18 count: usize,
19) -> Vec<f32> {
20 let distribution = rand::distributions::Uniform::new(min, max);
21 let mut rng = rand::thread_rng();
22 let mut result = Vec::with_capacity(count);
23 for _ in 0..count {
24 result.push(rng.sample(distribution));
25 }
26 return result;
27}