Uniform square#
Generate a random uniform sample of points within a unit hypercube.
The points are generated by sampling each coordinate independently from a uniform distribution \(U(0,1)\). This means for a point \((x_1, x_2, ..., x_d)\), each \(x_i\) is drawn from \(U(0,1)\). The points are therefore uniformly distributed over the volume of a n-dimensional hypercube with side length 1, anchored at the origin.
The use of a seed is recommended to ensure reproducibility.
Parameters#
n(int): The number of points to generate.seed(int): A seed for the random number generator.
Returns#
SetPoints: A new SetPoints object.
Example#
import proximitygraphs as pg
pts = pg.SetPoints.uniform_square(n=200, seed=73)
pts.draw(figsize=(8, 8), v_color='#1f77b4')