31 #include <boost/python.hpp> 32 #include "Randomize.hh" 36 using namespace CLHEP;
47 HepRandom::setTheSeed(seed);
52 HepRandom::setTheSeed(seed, lux);
61 long val= extract<long>(seedList[idx]);
67 long* seedArray=
new long[nsize];
69 for (
int i=0; i< nsize; i++) {
70 seedArray[i]= extract<long>(seedList[i]);
73 HepRandom::setTheSeeds(seedArray);
81 long val= extract<long>(seedList[idx]);
87 long* seedArray=
new long[nsize];
88 for (
int i=0; i< nsize; i++) {
89 seedArray[i]= extract<long>(seedList[i]);
92 HepRandom::setTheSeeds(seedArray, aux);
99 const long*
seeds= HepRandom::getTheSeeds();
102 if( seeds[idx]==0)
break;
103 seedList.append(seeds[idx]);
113 HepRandom::getTheTableSeeds(seedPair, index);
116 seedList.append(seedPair[0]);
117 seedList.append(seedPair[1]);
126 HepRandom::saveEngineStatus();
131 HepRandom::saveEngineStatus(filename);
137 HepRandom::restoreEngineStatus();
142 HepRandom::restoreEngineStatus(filename);
148 return RandBit::shootBit();
154 return RandGaussQ::shoot();
159 return RandGaussQ::shoot(mean, stdDev);
166 return G4UniformRand();
178 class_<HepRandom>(
"HepRandom",
"generate random number")
181 .def(init<HepRandomEngine&>())
182 .def(init<HepRandomEngine*>())
186 .staticmethod(
"setTheSeed")
187 .def(
"getTheSeed", &HepRandom::getTheSeed)
188 .staticmethod(
"getTheSeed")
191 .staticmethod(
"setTheSeeds")
193 .staticmethod(
"getTheSeeds")
195 .staticmethod(
"getTheTableSeeds")
197 .def(
"getTheGenerator", &HepRandom::getTheGenerator,
198 return_value_policy<reference_existing_object>())
199 .staticmethod(
"getTheGenerator")
200 .def(
"setTheEngine", &HepRandom::setTheEngine)
201 .staticmethod(
"setTheEngine")
202 .def(
"getTheEngine", &HepRandom::getTheEngine,
203 return_value_policy<reference_existing_object>())
204 .staticmethod(
"getTheEngine")
207 .staticmethod(
"saveEngineStatus")
210 .staticmethod(
"restoreEngineStatus")
211 .def(
"showEngineStatus", &HepRandom::showEngineStatus)
212 .staticmethod(
"showEngineStatus")
213 .def(
"createInstance", &HepRandom::createInstance)
214 .staticmethod(
"createInstance")
218 class_<RandBit, boost::noncopyable>
219 (
"RandBit",
"generate bit random number", no_init)
221 .staticmethod(
"shootBit")
225 class_<G4RandGauss, boost::noncopyable>
226 (
"G4RandGauss",
"generate gaussian random number", no_init)
229 .staticmethod(
"shoot")
void f1_setTheSeed(long seed)
void f1_setTheSeeds(const list &seedList)
void f1_saveEngineStatus()
void f2_setTheSeed(long seed, int lux)
list f_getTheTableSeeds(int index)
double f1_RandGaussQ_shoot()
void f2_saveEngineStatus(const char *filename)
void f1_restoreEngineStatus()
int f1_RandBit_shootBit()
std::vector< TrajPoint > seeds
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
void f2_restoreEngineStatus(const char *filename)
double f2_RandGaussQ_shoot(double mean, double stdDev)
void f2_setTheSeeds(const list &seedList, int aux)