21 #include "CLHEP/Random/defs.h"
22 #include "CLHEP/Random/JamesRandom.h"
23 #include "CLHEP/Random/Random.h"
24 #include "CLHEP/Random/StaticRandomStates.h"
25 #include "CLHEP/Utility/memory.h"
31 #include "CLHEP/Random/SeedTable.h"
39 defaults( HepRandom & g, HepJamesRandom & e )
44 void resetEngine( HepRandomEngine * newEngine ) {
48 void resetEngine( HepRandomEngine & newEngine ) {
49 theEngine.reset( &newEngine, do_nothing_deleter() );
52 bool ensureInitialized() {
65 defaults & theDefaults() {
66 static HepRandom theDefaultGenerator;
67 static HepJamesRandom theDefaultEngine;
68 static defaults theDefaults(theDefaultGenerator, theDefaultEngine);
86 theDefaults().resetEngine( algorithm );
91 theDefaults().resetEngine( algorithm );
99 return theDefaults().theEngine->flat();
104 theDefaults().theEngine->flatArray(size,vect);
113 std::cerr <<
"HepRandom::engine() called -- there is no assigned engine!\n";
114 return *theDefaults().theEngine.
get();
134 theDefaults().theEngine->setSeed(seed,lux);
139 return theDefaults().theEngine->getSeed();
144 theDefaults().theEngine->setSeeds(seeds,aux);
149 return theDefaults().theEngine->getSeeds();
154 if ((index >= 0) && (index < 215)) {
163 return theDefaults().theGenerator.
get();
168 return theDefaults().theEngine.
get();
178 theDefaults().theEngine->saveStatus( filename );
183 theDefaults().theEngine->restoreStatus( filename );
206 theDefaults().theEngine->showStatus();
211 return static_cast<int>( theDefaults().ensureInitialized() );
shared_ptr< HepRandom > theGenerator
shared_ptr< HepRandomEngine > theEngine
virtual std::istream & get(std::istream &is)
static HepRandom * getTheGenerator()
static HepRandomEngine * getTheEngine()
static const long * getTheSeeds()
virtual double operator()()
void flatArray(const int size, double *vect)
static std::ostream & saveStaticRandomStates(std::ostream &os)
static std::ostream & saveFullState(std::ostream &os)
virtual HepRandomEngine & engine()
static std::istream & restoreFullState(std::istream &is)
static void restoreEngineStatus(const char filename[]="Config.conf")
static void showEngineStatus()
virtual std::istream & get(std::istream &is)
static int createInstance()
static const long seedTable[215][2]
static void setTheSeeds(const long *seeds, int aux=-1)
virtual std::ostream & put(std::ostream &os) const
static void setTheEngine(HepRandomEngine *theNewEngine)
static void setTheSeed(long seed, int lux=3)
virtual std::string name() const
static void saveEngineStatus(const char filename[]="Config.conf")
static void getTheTableSeeds(long *seeds, int index)
static std::istream & restoreStaticRandomStates(std::istream &is)
static std::istream & restore(std::istream &is)
static std::ostream & save(std::ostream &os)
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)