Class FastThreadedRandom

  • All Implemented Interfaces:
    java.io.Serializable

    public class FastThreadedRandom
    extends java.util.Random
    Wrapper for quick multi-threaded PRNG access using multiple PRNGs.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Random[] prngs
      The random number generators.
      protected int threadingmask
      Mask for distributing threads.
    • Constructor Summary

      Constructors 
      Constructor Description
      FastThreadedRandom()
      Creates the wrapper.
      FastThreadedRandom​(java.lang.Class<?> randomclazz)
      Creates the wrapper.
      FastThreadedRandom​(java.lang.Class<?> randomclazz, int threadinglevel)
      Creates the wrapper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean nextBoolean()
      Wrapper method.
      void nextBytes​(byte[] bytes)
      Wrapper method.
      double nextDouble()
      Wrapper method.
      float nextFloat()
      Wrapper method.
      double nextGaussian()
      Wrapper method.
      int nextInt()
      Wrapper method.
      int nextInt​(int bound)
      Wrapper method.
      long nextLong()
      Wrapper method.
      void setSeed​(long seed)
      Wrapper method.
      • Methods inherited from class java.util.Random

        doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, next
      • Methods inherited from class java.lang.Object

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

      • prngs

        protected java.util.Random[] prngs
        The random number generators.
      • threadingmask

        protected int threadingmask
        Mask for distributing threads.
    • Constructor Detail

      • FastThreadedRandom

        public FastThreadedRandom()
        Creates the wrapper.
      • FastThreadedRandom

        public FastThreadedRandom​(java.lang.Class<?> randomclazz)
        Creates the wrapper.
      • FastThreadedRandom

        public FastThreadedRandom​(java.lang.Class<?> randomclazz,
                                  int threadinglevel)
        Creates the wrapper.
    • Method Detail

      • nextBoolean

        public boolean nextBoolean()
        Wrapper method.
        Overrides:
        nextBoolean in class java.util.Random
      • nextBytes

        public void nextBytes​(byte[] bytes)
        Wrapper method.
        Overrides:
        nextBytes in class java.util.Random
      • nextDouble

        public double nextDouble()
        Wrapper method.
        Overrides:
        nextDouble in class java.util.Random
      • nextFloat

        public float nextFloat()
        Wrapper method.
        Overrides:
        nextFloat in class java.util.Random
      • nextGaussian

        public double nextGaussian()
        Wrapper method.
        Overrides:
        nextGaussian in class java.util.Random
      • nextInt

        public int nextInt()
        Wrapper method.
        Overrides:
        nextInt in class java.util.Random
      • nextInt

        public int nextInt​(int bound)
        Wrapper method.
        Overrides:
        nextInt in class java.util.Random
      • nextLong

        public long nextLong()
        Wrapper method.
        Overrides:
        nextLong in class java.util.Random
      • setSeed

        public void setSeed​(long seed)
        Wrapper method. Warning: This is useless, included for completeness.
        Overrides:
        setSeed in class java.util.Random