Documentation of 'jsat.utils.random.RandomUtil' Java class
RandomUtil
jsat.utils.random

Class RandomUtil



  • public class RandomUtil
    extends java.lang.Object
    This class provides assorted utilities related to random number generation and use.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.util.concurrent.atomic.AtomicInteger DEFAULT_SEED
      If not specified, this will be the seed used for random objects used internally within JSAT.

      You may change this to any desired value at the start of any experiments to consistently get new experimental results.
      static boolean INCREMENT_SEEDS
      This controls whether or not getRandom() will cause a change in the DEFAULT_SEED each time it is called.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.Random getLocalRandom()
      Returns a Random object that is local to a given thread context, allowing re-usability at lower overhead.
      static java.util.Random getRandom()
      Returns a new Random object that can be used.
      static java.util.Random getRandom(int seed)
      Returns a new Random object that can be used, initiated with the given seed.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_SEED

        public static java.util.concurrent.atomic.AtomicInteger DEFAULT_SEED
        If not specified, this will be the seed used for random objects used internally within JSAT.

        You may change this to any desired value at the start of any experiments to consistently get new experimental results. You may also change it at any point without ill effect, but the purpose is for consistent and repeatable experiments.
      • INCREMENT_SEEDS

        public static boolean INCREMENT_SEEDS
        This controls whether or not getRandom() will cause a change in the DEFAULT_SEED each time it is called. This is the default to ensure that multiple calls to getRandom will not return an equivalent object.
    • Method Detail

      • getRandom

        public static java.util.Random getRandom()
        Returns a new Random object that can be used. The Random object returned is promised to be a reasonably high quality PSRND with low memory overhead that is faster to sample from than the default Java Random. Essentially, it will be better than Java's default PRNG in every way.

        By default, multiple calls to this method will result in multiple, different, seeds. Controlling the base seed and its behavior can be done using DEFAULT_SEED and INCREMENT_SEEDS.
        Returns:
        a new random number generator to use.
      • getRandom

        public static java.util.Random getRandom(int seed)
        Returns a new Random object that can be used, initiated with the given seed. The Random object returned is promised to be a reasonably high quality PSRND with low memory overhead that is faster to sample from than the default Java Random. Essentially, it will be better than Java's default PRNG in every way.
        Parameters:
        seed - the seed of the PRNG, which determines the sequence generated by the returned object
        Returns:
        a new random number generator to use.
      • getLocalRandom

        public static java.util.Random getLocalRandom()
        Returns a Random object that is local to a given thread context, allowing re-usability at lower overhead. Once a Random object is created for a thread, it will continue to exist.
        Returns:
        a Random object for use

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.