Class UnitBallSampler.UnitBallSampler2D
- java.lang.Object
-
- org.apache.commons.rng.sampling.shape.UnitBallSampler
-
- org.apache.commons.rng.sampling.shape.UnitBallSampler.UnitBallSampler2D
-
- All Implemented Interfaces:
ObjectSampler<double[]>
,SharedStateObjectSampler<double[]>
,SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
- UnitBallSampler
private static class UnitBallSampler.UnitBallSampler2D extends UnitBallSampler
Sample uniformly from a 2D unit disk.
-
-
Field Summary
Fields Modifier and Type Field Description private UniformRandomProvider
rng
The source of randomness.
-
Constructor Summary
Constructors Constructor Description UnitBallSampler2D(UniformRandomProvider rng)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
sample()
Create an object sample.UnitBallSampler
withUniformRandomProvider(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
-
rng
private final UniformRandomProvider rng
The source of randomness.
-
-
Constructor Detail
-
UnitBallSampler2D
UnitBallSampler2D(UniformRandomProvider rng)
- Parameters:
rng
- Source of randomness.
-
-
Method Detail
-
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
public UnitBallSampler withUniformRandomProvider(UniformRandomProvider rng)
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
-
-