Tsld014

  • Use shoot(HepRandomEngine*) methods to shoot values using an engine different from the one set for the static generator.

    • RanecuEngine* RNQ=new RanecuEngine;
      double exr=RandExponential::shoot(RNQ);
      int b=RandFlat::shootBit(RNQ);
      :
      const int size=32;
      double vect[size];
      RandFlat::shootArray(RNQ,size,vect);

Tsld012

  • Use shoot() static methods to shoot random values, given a distribution

    • double v=RandFlat::shoot();
      double v=RandGauss::shoot();
  • Use static methods defined in HepRandom to set/get the initial seed to the current engine

    • long new_seed=1894304173;
      HepRandom::setTheSeed(new_seed);
      long init_seed = HepRandom::getTheSeed();

Tsld011

  • Default engine of type HepJamesRandom already instantiated

  • Use static methods defined in HepRandom to set/get the main engine to the generator

    • HepRandomEngine* theNewEngine = new RanecuEngine;
      HepRandom::setTheEngine(theNewEngine);
    • HepRandomEngine* theEngine =
      HepRandom::getTheEngine();

Tsld009

  • By using the Static Generator defined in HepRandom

  • By skipping the Static Generator and specifying a local engine object

  • By skipping the Static Generator and instantiating a local distribution object associated to a local engine object

Tsld007

  • RanecuEngine

    • Originally implemented in F77 by Fred James, part of MathLib HEP library.
    • Uses a predefined table of couples of seeds to represent initial seeds and current seeds.
    • SetSeed() method sets the index-position in the table of seeds (index%size in case the given value exceeds table size).
    • SetSeeds() method sets the given couple of seeds as initial seeds in the table at a given position (optional).

Tsld008

  • Uniform interface: inheritance from

    HepRandom.

  • Collections of static and non-static methods

    with uniform signature, to shoot single values

    or array of random values, given a size.

  • shootBit() method in RandFlat for fast

    generation of 0/1 bits.