1use rand::prelude::*;
3
4pub fn random_frac_xy() -> [f64; 2] {
8 let xdist = rand::distributions::Uniform::new(0.0, 1.0);
9 let ydist = rand::distributions::Uniform::new(0.0, 1.0);
10
11 let x: f64 = thread_rng().sample(xdist);
12 let y: f64 = thread_rng().sample(ydist);
13 [x, y]
14}
15
16pub fn random_frac_xyz(zlow: f64, zhigh: f64) -> [f64; 3] {
20 let xdist = rand::distributions::Uniform::new(0.0, 1.0);
21 let ydist = rand::distributions::Uniform::new(0.0, 1.0);
22 let zdist = rand::distributions::Uniform::new(zlow, zhigh);
23
24 let x: f64 = thread_rng().sample(xdist);
25 let y: f64 = thread_rng().sample(ydist);
26 let z: f64 = thread_rng().sample(zdist);
27 [x, y, z]
28}
29