Package de.gsi.math

Class TRandom1


  • public class TRandom1
    extends TRandom
    • Constructor Summary

      Constructors 
      Constructor Description
      TRandom1()
      default constructor
      TRandom1​(long seed, int lux)
      Luxury level is set in the same way as the original FORTRAN routine.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double Rndm​(int rnd)
      return a random number in ]0,1]
      void RndmArray​(int size, double[] vect)
      return an array of random numbers in ]0,1]
      void RndmArray​(int size, float[] vect)
      return an array of random numbers in ]0,1]
      void SetSeed​(long seed)
      Set RanLux seed using default luxury level
      void SetSeed2​(long seed, int lux)
      The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "A review of pseudorandom number generators" (Fred James) published in Computer Physics Communications 60 (1990) pages 329-344
      void SetSeeds​(long seeds, int lux)
      set seeds
      • Methods inherited from class java.lang.Object

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

      • fgNumEngines

        protected static int fgNumEngines
      • fgMaxIndex

        protected static int fgMaxIndex
      • fNskip

        protected int fNskip
      • fLuxury

        protected int fLuxury
      • fIlag

        protected int fIlag
      • fJlag

        protected int fJlag
      • fCount24

        protected int fCount24
      • fFloatSeedTable

        protected float[] fFloatSeedTable
      • fCarry

        protected float fCarry
      • fIntModulus

        protected final int fIntModulus
      • fTheSeeds

        protected final long fTheSeeds
      • fMantissaBit24

        protected final double fMantissaBit24
      • fMantissaBit12

        protected final double fMantissaBit12
    • Constructor Detail

      • TRandom1

        public TRandom1()
        default constructor
      • TRandom1

        public TRandom1​(long seed,
                        int lux)
        Luxury level is set in the same way as the original FORTRAN routine. level 0 (p=24): equivalent to the original RCARRY of Marsaglia and Zaman, very long period, but fails many tests. level 1 (p=48): considerable improvement in quality over level 0, now passes the gap test, but still fails spectral test. level 2 (p=97): passes all known tests, but theoretically still defective. level 3 (p=223): DEFAULT VALUE. Any theoretically possible correlations have very small chance of being observed. level 4 (p=389): highest possible luxury, all 24 bits chaotic.
        Parameters:
        seed - initial seed
        lux - initial luxury
    • Method Detail

      • Rndm

        public double Rndm​(int rnd)
        return a random number in ]0,1]
        Parameters:
        rnd - empty seed
        Returns:
        random number in ]0,1]
      • RndmArray

        public void RndmArray​(int size,
                              double[] vect)
        return an array of random numbers in ]0,1]
        Parameters:
        size - size of storage vector
        vect - storage vector
      • RndmArray

        public void RndmArray​(int size,
                              float[] vect)
        return an array of random numbers in ]0,1]
        Overrides:
        RndmArray in class TRandom
        Parameters:
        size - length of array
        vect - storage array
      • SetSeed

        public void SetSeed​(long seed)
        Set RanLux seed using default luxury level
        Overrides:
        SetSeed in class TRandom
        Parameters:
        seed - initial seed
      • SetSeed2

        public void SetSeed2​(long seed,
                             int lux)
        The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "A review of pseudorandom number generators" (Fred James) published in Computer Physics Communications 60 (1990) pages 329-344
        Parameters:
        seed - initial seed
        lux - initial luxury
      • SetSeeds

        public void SetSeeds​(long seeds,
                             int lux)
        set seeds
        Parameters:
        seeds - initial seed
        lux - initial luxury