Class BoxSampler.BoxSampler2D
- java.lang.Object
-
- org.apache.commons.rng.sampling.shape.BoxSampler
-
- org.apache.commons.rng.sampling.shape.BoxSampler.BoxSampler2D
-
- All Implemented Interfaces:
ObjectSampler<double[]>
,SharedStateObjectSampler<double[]>
,SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
- BoxSampler
private static class BoxSampler.BoxSampler2D extends BoxSampler
Sample uniformly from a box in 2D. This is an non-array based specialisation ofBoxSampler.BoxSamplerND
for performance.
-
-
Constructor Summary
Constructors Constructor Description BoxSampler2D(UniformRandomProvider rng, double[] a, double[] b)
BoxSampler2D(UniformRandomProvider rng, BoxSampler.BoxSampler2D source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
sample()
Create an object sample.BoxSampler
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.BoxSampler
createSample, 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
-
-
-
-
Constructor Detail
-
BoxSampler2D
BoxSampler2D(UniformRandomProvider rng, double[] a, double[] b)
- Parameters:
rng
- Source of randomness.a
- Bound a.b
- Bound b.
-
BoxSampler2D
BoxSampler2D(UniformRandomProvider rng, BoxSampler.BoxSampler2D source)
- Parameters:
rng
- Source of randomness.source
- Source to copy.
-
-
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 classBoxSampler
- Returns:
- a random Cartesian coordinate within the box.
-
withUniformRandomProvider
public BoxSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from class:BoxSampler
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 classBoxSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-