Package org.joml

Class Random

java.lang.Object
org.joml.Random

public class Random extends Object
Pseudo-random number generator.
Author:
Kai Burjack
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new instance of Random and initialize it with a random seed.
    Random(long seed)
    Create a new instance of Random and initialize it with the given seed.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
     
    float
    Generate a uniformly distributed floating-point number in the half-open range [0, 1).
    int
    nextInt(int n)
    Generate a uniformly distributed integer in the half-open range [0, n).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Random

      public Random()
      Create a new instance of Random and initialize it with a random seed.
    • Random

      public Random(long seed)
      Create a new instance of Random and initialize it with the given seed.
      Parameters:
      seed - the seed number
  • Method Details

    • newSeed

      public static long newSeed()
    • nextFloat

      public float nextFloat()
      Generate a uniformly distributed floating-point number in the half-open range [0, 1).
      Returns:
      a random float in the range [0..1)
    • nextInt

      public int nextInt(int n)
      Generate a uniformly distributed integer in the half-open range [0, n).
      Parameters:
      n - the upper limit (exclusive) of the generated integer
      Returns:
      a random integer in the range [0..n)