Package org.joml

Class Random


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

      Constructors 
      Constructor Description
      Random()
      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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static long newSeed()  
      float nextFloat()
      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 Detail

      • 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 Detail

      • 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)