Class RandomUtils


  • public class RandomUtils
    extends java.lang.Object
    Factory for creating generators of miscellaneous data.
    Since:
    4.0
    • Method Detail

      • createDataGenerator

        public static RandomUtils.DataGenerator createDataGenerator​(java.util.Random rng)
        Wraps an instance of the JDK's Random class. The actual generation of random numbers will be delegated to that instance.

        If cryptographically secure data is required, one can use this factory method, with an instance of the SecureRandom class as the argument. Note that data generation will be much slower in this case.

        Parameters:
        rng - Underlying generator. Reference is copied so the RNG is shared with the caller.
        Returns:
        a data generator.
      • asUniformRandomProvider

        public static UniformRandomProvider asUniformRandomProvider​(java.util.Random rng)
        Wraps a Random instance.
        Parameters:
        rng - JDK Random instance to which the random number generation is delegated. Reference is copied so the RNG is shared with the caller.
        Returns:
        a UniformRandomProvider instance.