java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.std.Mt19937
All Implemented Interfaces:
ConstJoltPhysicsObject, RandomNumberEngine, AutoCloseable, Comparable<JoltPhysicsObject>

public class Mt19937 extends JoltPhysicsObject implements RandomNumberEngine
Generate a pseudo-random sequence of integers using a 32-bit Mersenne Twister. (native type: std::mt19937)

The algorithm isn't specific to Jolt Physics. It's included in Jolt JNI for expediency, since MutableCompoundShapeTest.h uses it.

  • Constructor Details

    • Mt19937

      public Mt19937()
      Instantiate a generator.
    • Mt19937

      public Mt19937(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 interface RandomNumberEngine
      Returns:
      an integer value
    • seed

      public void seed(int value)
      Seed the engine with the specified value.
      Specified by:
      seed in interface RandomNumberEngine
      Parameters:
      value - the value to use