Class BoxSampler.BoxSampler3D
java.lang.Object
org.apache.commons.rng.sampling.shape.BoxSampler
org.apache.commons.rng.sampling.shape.BoxSampler.BoxSampler3D
- All Implemented Interfaces:
ObjectSampler<double[]>, SharedStateObjectSampler<double[]>, SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
BoxSampler
Sample uniformly from a box in 3D. This is an non-array based specialisation of
BoxSampler.BoxSamplerND for performance.- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleThe x component of bound a.private final doubleThe y component of bound a.private final doubleThe z component of bound a.private final doubleThe x component of bound b.private final doubleThe y component of bound b.private final doubleThe z component of bound b. -
Constructor Summary
ConstructorsConstructorDescriptionBoxSampler3D(UniformRandomProvider rng, double[] a, double[] b) BoxSampler3D(UniformRandomProvider rng, BoxSampler.BoxSampler3D source) -
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 BoxSampler
createSample, ofMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectSampler
samples, samples
-
Field Details
-
ax
private final double axThe x component of bound a. -
ay
private final double ayThe y component of bound a. -
az
private final double azThe z component of bound a. -
bx
private final double bxThe x component of bound b. -
by
private final double byThe y component of bound b. -
bz
private final double bzThe z component of bound b.
-
-
Constructor Details
-
BoxSampler3D
BoxSampler3D(UniformRandomProvider rng, double[] a, double[] b) - Parameters:
rng- Source of randomness.a- Bound a.b- Bound b.
-
BoxSampler3D
BoxSampler3D(UniformRandomProvider rng, BoxSampler.BoxSampler3D source) - Parameters:
rng- Source of randomness.source- Source to copy.
-
-
Method Details
-
sample
public double[] sample()Description copied from interface:ObjectSamplerCreate an object sample.- Specified by:
samplein interfaceObjectSampler<double[]>- Specified by:
samplein classBoxSampler- Returns:
- a random Cartesian coordinate within the box.
-
withUniformRandomProvider
Description copied from class:BoxSamplerCreate 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 classBoxSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-