Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.random
Class UnitSphereRandomVectorGenerator

    java.lang.Object
      org.apache.commons.math.random.UnitSphereRandomVectorGenerator

All Implemented Interfaces:
  RandomVectorGenerator

    public class UnitSphereRandomVectorGenerator

extends java.lang.Object
implements RandomVectorGenerator

Generate random vectors isotropically located on the surface of a sphere.

Since:
  2.1
Version:
  $Revision: 925812 $ $Date: 2010-03-21 11:49:31 -0400 (Sun, 21 Mar 2010) $

Field Summary
`private int` | `dimension` Space dimension.
`private RandomGenerator` | `rand` RNG used for generating the individual components of the vectors.

Constructor Summary
`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
`double[]` | `nextVector()` Generate a random vector.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rand

    private final RandomGenerator rand

  RNG used for generating the individual components of the vectors.

### dimension

    private final int dimension

  Space dimension.

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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2011 Apache Software Foundation