sample_hypersphere

sample_hypersphere#

QuadratiK.tools.sample_hypersphere(npoints: int = 100, ndim: int = 3, random_state: int | None = None) ndarray#

Generate random samples from the hypersphere.

Parameters#

npointsint, optional.

The number of points to generate. Default is 100.

ndimint, optional.

The dimensionality of the hypersphere. Default is 3.

random_stateint, None, optional.

Seed for random number generation. Defaults to None.

Returns#

data on spherenumpy.ndarray

An array containing random vectors sampled uniformly from the surface of the hypersphere.

Examples#

from QuadratiK.tools import sample_hypersphere
print(sample_hypersphere(5, 3, random_state = 42))
[[ 0.60000205 -0.1670153   0.78237039]
 [ 0.97717133 -0.15023209 -0.15022156]
 [ 0.86889694  0.42224942 -0.25830898]
 [ 0.63675162 -0.5438697  -0.54658314]
 [ 0.09351637 -0.73946664 -0.66666616]]