Package org.apache.commons.rng.sampling
Class UnitSphereSampler.UnitSphereSampler3D
- java.lang.Object
-
- org.apache.commons.rng.sampling.UnitSphereSampler
-
- org.apache.commons.rng.sampling.UnitSphereSampler.UnitSphereSampler3D
-
- All Implemented Interfaces:
ObjectSampler<double[]>,SharedStateObjectSampler<double[]>,SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
- UnitSphereSampler
private static final class UnitSphereSampler.UnitSphereSampler3D extends UnitSphereSampler
Sample uniformly from a 3D unit sphere. This is a 3D specialisation of the UnitSphereSamplerND.
-
-
Field Summary
Fields Modifier and Type Field Description private NormalizedGaussianSamplersamplerSampler used for generating the individual components of the vectors.
-
Constructor Summary
Constructors Constructor Description UnitSphereSampler3D(UniformRandomProvider rng)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]sample()Create an object sample.UnitSphereSamplerwithUniformRandomProvider(UniformRandomProvider rng)Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.-
Methods inherited from class org.apache.commons.rng.sampling.UnitSphereSampler
nextVector, of
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.ObjectSampler
samples, samples
-
-
-
-
Field Detail
-
sampler
private final NormalizedGaussianSampler sampler
Sampler used for generating the individual components of the vectors.
-
-
Constructor Detail
-
UnitSphereSampler3D
UnitSphereSampler3D(UniformRandomProvider rng)
- Parameters:
rng- Source of randomness.
-
-
Method Detail
-
sample
public double[] sample()
Description copied from interface:ObjectSamplerCreate an object sample.- Specified by:
samplein interfaceObjectSampler<double[]>- Overrides:
samplein classUnitSphereSampler- Returns:
- a random normalized Cartesian vector.
-
withUniformRandomProvider
public UnitSphereSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from class:UnitSphereSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateObjectSampler<double[]>>- Overrides:
withUniformRandomProviderin classUnitSphereSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-