org.apache.commons.math3.random

## Class UnitSphereRandomVectorGenerator

- java.lang.Object
- - org.apache.commons.math3.random.UnitSphereRandomVectorGenerator

- All Implemented Interfaces:
    RandomVectorGenerator

      public class UnitSphereRandomVectorGenerator
      extends Object
      implements RandomVectorGenerator

  Generate random vectors isotropically located on the surface of a sphere.
  Since:
    2.1
  Version:
    $Id: UnitSphereRandomVectorGenerator.java 1244107 2012-02-14 16:17:55Z erans $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnitSphereRandomVectorGenerator(int dimension)` Create an object that will use a default RNG (`MersenneTwister`), in order to generate the individual components.
    `UnitSphereRandomVectorGenerator(int dimension, RandomGenerator rand)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `nextVector()` Generate a random vector.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UnitSphereRandomVectorGenerator

          public UnitSphereRandomVectorGenerator(int dimension,
                                         RandomGenerator rand)

      Parameters:
        `dimension` - Space dimension.
        `rand` - RNG for the individual components of the vectors.

    - #### UnitSphereRandomVectorGenerator

          public UnitSphereRandomVectorGenerator(int dimension)

      Create an object that will use a default RNG (`MersenneTwister`), in order to generate the individual components.
      Parameters:
        `dimension` - Space dimension.

  - ### Method Detail

    - #### nextVector

          public double[] nextVector()

      Generate a random vector.
      Specified by:
        `nextVector` in interface `RandomVectorGenerator`
      Returns:
        a random vector as an array of double.

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.