Class HypersphereRVG

java.lang.Object
dev.nm.stat.random.rng.multivariate.HypersphereRVG
All Implemented Interfaces:
RandomVectorGenerator, Seedable

public class HypersphereRVG extends Object implements RandomVectorGenerator
Generates uniformly distributed points on the surface of a hypersphere.
See Also:
    • "Marsaglia, G. "Choosing a Point from the Surface of a Sphere," Ann. Math. Stat. 43, 645-646, 1972."
    • http://mathworld.wolfram.com/HyperspherePointPicking.html
  • Constructor Details

    • HypersphereRVG

      public HypersphereRVG(int dimension, RandomStandardNormalGenerator rnorm)
      Constructs a hypersphere RVG to generate random uniform points.
      Parameters:
      dimension - the dimension of the hypersphere
      rnorm - the standard Normal RNG to be used
    • HypersphereRVG

      public HypersphereRVG(int dimension)
      Constructs a hypersphere RVG to generate random uniform points.
      Parameters:
      dimension - the dimension of the hypersphere
  • Method Details

    • seed

      public void seed(long... seeds)
      Description copied from interface: Seedable
      Seed the random number/vector/scenario generator to produce repeatable experiments.
      Specified by:
      seed in interface Seedable
      Parameters:
      seeds - the seeds
    • nextVector

      public double[] nextVector()
      Description copied from interface: RandomVectorGenerator
      Gets the next random vector.
      Specified by:
      nextVector in interface RandomVectorGenerator
      Returns:
      the next random vector