Class UnitBallSampler.UnitBallSamplerND
java.lang.Object
org.apache.commons.rng.sampling.shape.UnitBallSampler
org.apache.commons.rng.sampling.shape.UnitBallSampler.UnitBallSamplerND
- All Implemented Interfaces:
ObjectSampler<double[]>, SharedStateObjectSampler<double[]>, SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
UnitBallSampler
Sample using ball point picking.
- Since:
- 1.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe dimension.private final ContinuousSamplerThe exponential distribution (mean=1).private final NormalizedGaussianSamplerThe 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 UnitBallSampler
ofMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectSampler
samples, samples
-
Field Details
-
dimension
private final int dimensionThe dimension. -
normal
The standard normal distribution. -
exp
The exponential distribution (mean=1).
-
-
Constructor Details
-
UnitBallSamplerND
UnitBallSamplerND(UniformRandomProvider rng, int dimension) - Parameters:
rng- Source of randomness.dimension- Space dimension.
-
-
Method Details
-
sample
public double[] sample()Description copied from interface:ObjectSamplerCreate an object sample.- Specified by:
samplein interfaceObjectSampler<double[]>- Specified by:
samplein classUnitBallSampler- Returns:
- a random Cartesian coordinate within the unit n-ball.
-
withUniformRandomProvider
Description copied from class:UnitBallSamplerCreate 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[]>>- Specified by:
withUniformRandomProviderin classUnitBallSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-