Package org.joml

Class Random



  • public class Random
    extends Object
    Pseudo-random number generator.
    Author:
    Kai Burjack
    • 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)