pub fn init_from_random(nb_points: usize, nb_dim: usize, seed: u64) -> PointSet {
        let mut points: Vec<Vec<f64>> = Vec::with_capacity(nb_points);

        let mut rng = SmallRng::seed_from_u64(seed);

        // Generate random points
        for _ in 0..nb_points {
            let mut point: Vec<f64> = Vec::with_capacity(nb_dim);
            for _ in 0..nb_dim {
                point.push(rng.gen::<f64>());
            }
            points.push(point);
        }

        PointSet::init_from_preset(points)
    }
/// Creates a 'PointSet' using a random initialisation of the points following a uniform distribution.
///
/// # Arguments
///
/// * `nb_points` - The number of points in the set before running WSP.
/// * `nb_dim` - The dimension of the points.
/// * `seed` - The seed used for the uniform sampling of the coordinates of the points.
///
/// # Example
///
/// The following code snippet creates a PointSet with 100 points of dimension 10. The seed 51 is used for the
/// generation of the points.
/// ```
/// let poinset = wsp::PointSet::init_from_random(100, 10, 51); // Give ownership
/// ```
Creates a 'PointSet' using a random initialisation of the points following a uniform distribution.
Creates a ' PointSet ' using a random initialisation of the points following a uniform distribution .
pub fn init_from_random(nb_points: usize, nb_dim: usize, seed: u64) -> PointSet {
        let mut points: Vec<Vec<f64>> = Vec::with_capacity(nb_points);
        let mut rng = SmallRng::seed_from_u64(seed);
        // Generate random points
        for _ in 0..nb_points {
            let mut point: Vec<f64> = Vec::with_capacity(nb_dim);
            for _ in 0..nb_dim {
                point.push(rng.gen::<f64>());
            }
            points.push(point);
        }
        PointSet::init_from_preset(points)
    }
pub fn init_from_random ( nb_points : usize , nb_dim : usize , seed : u64 ) -> PointSet { let mut points : Vec < Vec < f64 > > = Vec :: with_capacity ( nb_points ) ; let mut rng = SmallRng :: seed_from_u64 ( seed ) ; // Generate random points for _ in 0 .. nb_points { let mut point : Vec < f64 > = Vec :: with_capacity ( nb_dim ) ; for _ in 0 .. nb_dim { point . push ( rng . gen :: < f64 > ( ) ) ; } points . push ( point ) ; } PointSet :: init_from_preset ( points ) }
Creates a 'PointSet' using a random initialisation of the points following a uniform distribution.
Creates a ' PointSet ' using a random initialisation of the points following a uniform distribution .
nb_points
usize
nb_dim
usize
seed
u64
nb_points
usize
nb_dim
usize
seed
u64
example
The following code snippet creates a PointSet with 100 points of dimension 10. The seed 51 is used for the
generation of the points.
The following code snippet creates a PointSet with 100 points of dimension 10 . The seed 51 is used for the generation of the points .