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
private static final class UnitBallSampler.UnitBallSamplerND extends UnitBallSampler
Sample using ball point picking.- See Also:
- Ball point picking
-
-
Field Summary
Fields Modifier and Type Field Description private intdimensionThe dimension.private ContinuousSamplerexpThe exponential distribution (mean=1).private NormalizedGaussianSamplernormalThe standard normal distribution.
-
Constructor Summary
Constructors Constructor Description UnitBallSamplerND(UniformRandomProvider rng, int dimension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]sample()Create an object sample.UnitBallSamplerwithUniformRandomProvider(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.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 Detail
-
dimension
private final int dimension
The dimension.
-
normal
private final NormalizedGaussianSampler normal
The standard normal distribution.
-
exp
private final ContinuousSampler exp
The exponential distribution (mean=1).
-
-
Constructor Detail
-
UnitBallSamplerND
UnitBallSamplerND(UniformRandomProvider rng, int dimension)
- Parameters:
rng- Source of randomness.dimension- Space dimension.
-
-
Method Detail
-
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
public UnitBallSampler withUniformRandomProvider(UniformRandomProvider rng)
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
-
-