Class UnitBallSampler.UnitBallSampler3D
java.lang.Object
org.apache.commons.rng.sampling.shape.UnitBallSampler
org.apache.commons.rng.sampling.shape.UnitBallSampler.UnitBallSampler3D
- All Implemented Interfaces:
ObjectSampler<double[]>
,SharedStateObjectSampler<double[]>
,SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
UnitBallSampler
Sample uniformly from a 3D unit ball. This is an non-array based specialisation of
UnitBallSampler.UnitBallSamplerND
for performance.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ContinuousSampler
The exponential distribution (mean=1).private final NormalizedGaussianSampler
The standard normal distribution. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
sample()
Create an object sample.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.shape.UnitBallSampler
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 Details
-
normal
The standard normal distribution. -
exp
The exponential distribution (mean=1).
-
-
Constructor Details
-
UnitBallSampler3D
UnitBallSampler3D(UniformRandomProvider rng) - Parameters:
rng
- Source of randomness.
-
-
Method Details
-
sample
public double[] sample()Description copied from interface:ObjectSampler
Create an object sample.- Specified by:
sample
in interfaceObjectSampler<double[]>
- Specified by:
sample
in classUnitBallSampler
- Returns:
- a random Cartesian coordinate within the unit n-ball.
-
withUniformRandomProvider
Description copied from class:UnitBallSampler
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateObjectSampler<double[]>>
- Specified by:
withUniformRandomProvider
in classUnitBallSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-