00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "JamesRandom.h"
00029 #include "Random.h"
00030
00031
00032
00033
00034
00035 HepJamesRandom theMainEngine;
00036 HepRandom aGenerator(theMainEngine);
00037 HepRandom* HepRandom::theGenerator = &aGenerator;
00038
00039
00040
00041 HepRandom::HepRandom()
00042 : theEngine(new HepJamesRandom), deleteEngine(true),
00043 set(false), oldm(-1.0), nextGauss(0.0), meanMax(2.0E9) {
00044 for (HepInt i=0; i<3; ++i)
00045 status[i] = 0.;
00046 }
00047
00048 HepRandom::HepRandom(long seed)
00049 : theEngine(new HepJamesRandom(seed)), deleteEngine(true),
00050 set(false), oldm(-1.0), nextGauss(0.0), meanMax(2.0E9) {
00051 for (HepInt i=0; i<3; ++i)
00052 status[i] = 0.;
00053 }
00054
00055 HepRandom::HepRandom(HepRandomEngine & algorithm)
00056 : theEngine(&algorithm), deleteEngine(false),
00057 set(false), oldm(-1.0), nextGauss(0.0), meanMax(2.0E9) {
00058
00059 for (HepInt i=0; i<3; ++i)
00060 status[i] = 0.;
00061 }
00062
00063 HepRandom::HepRandom(HepRandomEngine * algorithm)
00064 : theEngine(algorithm), deleteEngine(true),
00065 set(false), oldm(-1.0), nextGauss(0.0), meanMax(2.0E9) {
00066 for (HepInt i=0; i<3; ++i)
00067 status[i] = 0.;
00068 }
00069
00070 HepRandom::~HepRandom() {
00071 if ( deleteEngine ) delete theEngine;
00072 }
00073
00074 HepDouble HepRandom::operator()() {
00075 return flat();
00076 }
00077
00078
00079
00080
00081
00082 void HepRandom::setTheSeed(long seed, HepInt lux)
00083 {
00084 theGenerator->setSeed(seed,lux);
00085 }
00086
00087 long HepRandom::getTheSeed()
00088 {
00089 return theGenerator->getSeed();
00090 }
00091
00092 void HepRandom::setTheSeeds(const long* seeds, HepInt aux)
00093 {
00094 theGenerator->setSeeds(seeds,aux);
00095 }
00096
00097 const long* HepRandom::getTheSeeds ()
00098 {
00099 return theGenerator->getSeeds();
00100 }
00101
00102 void HepRandom::getTheTableSeeds (long* seeds, HepInt index)
00103 {
00104 theGenerator->getTableSeeds(seeds, index);
00105 }
00106
00107 void HepRandom::setTheEngine (HepRandomEngine* theNewEngine)
00108 {
00109 theGenerator->setEngine(theNewEngine);
00110 }
00111
00112 HepRandomEngine * HepRandom::getTheEngine()
00113 {
00114 return theGenerator->getEngine();
00115 }
00116
00117 void HepRandom::saveEngineStatus()
00118 {
00119 theGenerator->saveStatus();
00120 }
00121
00122 void HepRandom::restoreEngineStatus()
00123 {
00124 theGenerator->restoreStatus();
00125 }
00126
00127 void HepRandom::showEngineStatus()
00128 {
00129 theGenerator->showStatus();
00130 }