Class Random


  • public class Random
    extends java.lang.Object
    Random Utility
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T oneOf​(T[] arr)
      Returns a random element from the provided array.
      static int uint32()
      Generates a random 31-bit unsigned integer.
      static long ulong53()
      Generates a random 53-bit unsigned long.
      static java.lang.String uuidv4()
      Generates a random UUID (version 4).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • uint32

        public static int uint32()
        Generates a random 31-bit unsigned integer.
        Returns:
        A random 31-bit unsigned integer.
      • ulong53

        public static long ulong53()
        Generates a random 53-bit unsigned long.
        Returns:
        A random 53-bit unsigned long.
      • oneOf

        public static <T> T oneOf​(T[] arr)
        Returns a random element from the provided array.
        Type Parameters:
        T - The type of elements in the array.
        Parameters:
        arr - The array from which to pick a random element.
        Returns:
        A random element from the array.
      • uuidv4

        public static java.lang.String uuidv4()
        Generates a random UUID (version 4).
        Returns:
        A randomly generated UUID (version 4).