Documentation of 'com.datumbox.framework.common.utilities.RandomGenerator' Java class
RandomGenerator
com.datumbox.framework.common.utilities

Class RandomGenerator



  • public class RandomGenerator
    extends java.lang.Object
    The RandomGenerator generates Random objects that can be read and modified by the same thread. The class can be configured with a globalSeed that is used to initialize all the generated Random objects.
    • Constructor Summary

      Constructors 
      Constructor and Description
      RandomGenerator() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.Long getGlobalSeed()
      Getter for the global seed.
      static java.util.Random getThreadLocalRandom()
      Returns a Random object which is stored as ThreadLocal variable and as a result each Thread has an independent copy of this variable.
      static java.util.Random getThreadLocalRandomUnseeded()
      Returns a Random object which is local for the thread but unseeded.
      static void setGlobalSeed(java.lang.Long globalSeed)
      Setter for the global seed.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RandomGenerator

        public RandomGenerator()
    • Method Detail

      • getGlobalSeed

        public static java.lang.Long getGlobalSeed()
        Getter for the global seed. The global seed affects the initial seeding of all the Random objects that are generated by this class.
        Returns:
      • setGlobalSeed

        public static void setGlobalSeed(java.lang.Long globalSeed)
        Setter for the global seed. The global seed affects the initial seeding of all the Random objects that are generated by this class. Changing the global seed does not affect the Random objects that have already been generated. If you wish to change the seed of an already initialized Random object use the setSeed() method of that object.
        Parameters:
        globalSeed -
      • getThreadLocalRandom

        public static java.util.Random getThreadLocalRandom()
        Returns a Random object which is stored as ThreadLocal variable and as a result each Thread has an independent copy of this variable. When the Random objects are initialized, they seeded with the global seed (if not null).
        Returns:
      • getThreadLocalRandomUnseeded

        public static java.util.Random getThreadLocalRandomUnseeded()
        Returns a Random object which is local for the thread but unseeded.
        Returns:

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.