random_3d_points/lib.rs
1use wasm_bindgen::prelude::*;
2use random_fast_rng::{FastRng, Random};
3
4pub fn generate_points(points_count: usize) -> Vec<f32> {
5 let mut rng = FastRng::new(); // Create a new random number generator
6 let mut points = Vec::with_capacity(points_count * 3);
7
8 for _ in 0..points_count {
9 points.push(rng.gen::<f32>() * 200.0 - 100.0); // X
10 points.push(rng.gen::<f32>() * 200.0 - 100.0); // Y
11 points.push(rng.gen::<f32>() * 200.0 - 100.0); // Z
12 }
13
14 points
15}
16
17
18
19