Class UniformIntDistribution

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

public class UniformIntDistribution extends JoltPhysicsObject
Generate uniformly distributed int values. (native type: std::uniform_int_distribution<int>)

The algorithm isn't specific to Jolt Physics; it's included in jolt-jni for expediency, since BroadPhaseInsertionTest.cpp uses it.

  • Constructor Details

    • UniformIntDistribution

      public UniformIntDistribution(int min, int max)
      Instantiate a uniform distribution with the specified range of output values.
      Parameters:
      min - the desired (inclusive) lower limit
      max - the desired (inclusive) upper limit
  • Method Details

    • nextInt

      public int nextInt(DefaultRandomEngine generator)
      Iterate and return the next int value in the sequence.
      Parameters:
      generator - the sequence generator to use (not null)
      Returns:
      the value
    • nextInt

      public int nextInt(Mt19937 generator)
      Iterate and return the next int value in the sequence.
      Parameters:
      generator - the sequence generator to use (not null)
      Returns:
      the value