Class DefaultRandomEngine
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.std.DefaultRandomEngine
- All Implemented Interfaces:
ConstJoltPhysicsObject
,RandomNumberEngine
,AutoCloseable
,Comparable<JoltPhysicsObject>
Generate a pseudo-random sequence of integers for casual use. (native type:
std::default_random_engine)
The algorithm isn't specific to Jolt Physics. It's included in Jolt JNI for expediency, since BroadPhaseTest.cpp uses it.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a generator.DefaultRandomEngine
(int seed) Instantiate a generator using the specified 32-bit seed. -
Method Summary
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
DefaultRandomEngine
public DefaultRandomEngine()Instantiate a generator. -
DefaultRandomEngine
public DefaultRandomEngine(int seed) Instantiate a generator using the specified 32-bit seed.- Parameters:
seed
- for initialization
-
-
Method Details
-
nextInt
public int nextInt()Return the next integer in the sequence.- Specified by:
nextInt
in interfaceRandomNumberEngine
- Returns:
- an integer value
-
seed
public void seed(int value) Seed the engine with the specified value.- Specified by:
seed
in interfaceRandomNumberEngine
- Parameters:
value
- the value to use
-