Package jme3utilities.math.noise
Class Generator
java.lang.Object
java.util.Random
jme3utilities.math.noise.Generator
- All Implemented Interfaces:
Serializable
,RandomGenerator
Generate pseudo-random numbers, quaternions, vectors, and selections.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.random.RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
nextFloat
(float e1, float e2) Generate a single-precision value, uniformly distributed between 2 extremes.int
nextInt
(int e1, int e2) Generate an integer value, uniformly distributed between 2 extremes.nextQuaternion
(Quaternion storeResult) Generate a uniformly distributed, pseudo-random unit quaternion.nextUnitVector3f
(Vector3f storeResult) Generate a uniformly distributed, pseudo-random unit vector.nextVector3f
(Vector3f storeResult) Generate a pseudo-random vector that is uniformly distributed throughout the unit sphere centered on the origin.<E> E
pick
(E[] array) Pick a pseudo-random element from the specified array.Methods inherited from class java.util.Random
doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.random.RandomGenerator
isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextGaussian, nextLong, nextLong
-
Constructor Details
-
Generator
public Generator()Instantiate a pseudo-random generator with a seed likely to be unique. -
Generator
public Generator(long seed) Instantiate a pseudo-random generator with the specified seed.- Parameters:
seed
- initial value for the seed
-
-
Method Details
-
nextFloat
public float nextFloat(float e1, float e2) Generate a single-precision value, uniformly distributed between 2 extremes.- Parameters:
e1
- the first extremee2
- the 2nd extreme- Returns:
- a pseudo-random value (≥min(e1,e2), ≤max(e1,e2))
-
nextInt
public int nextInt(int e1, int e2) Generate an integer value, uniformly distributed between 2 extremes.- Parameters:
e1
- the first extremee2
- the 2nd extreme- Returns:
- a pseudo-random value (≥min(e1,e2), ≤max(e1,e2))
-
nextQuaternion
Generate a uniformly distributed, pseudo-random unit quaternion.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a unit quaternion (either storeResult or a new instance)
-
nextUnitVector3f
Generate a uniformly distributed, pseudo-random unit vector.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a unit vector (either storeResult or a new instance)
-
nextVector3f
Generate a pseudo-random vector that is uniformly distributed throughout the unit sphere centered on the origin.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a vector with length≤1 (either storeResult or a new instance)
-
pick
public <E> E pick(E[] array) Pick a pseudo-random element from the specified array.- Type Parameters:
E
- the type of list elements- Parameters:
array
- the array to select from (not null, may be empty)- Returns:
- a pre-existing element of array, or null if it's empty
-