32 #include <boost/python.hpp> 33 #include "Randomize.hh" 37 using namespace CLHEP;
48 HepRandom::setTheSeed(seed);
53 HepRandom::setTheSeed(seed, lux);
62 long val= extract<long>(seedList[idx]);
68 long* seedArray=
new long[nsize];
70 for (
int i=0; i< nsize; i++) {
71 seedArray[i]= extract<long>(seedList[i]);
74 HepRandom::setTheSeeds(seedArray);
82 long val= extract<long>(seedList[idx]);
88 long* seedArray=
new long[nsize];
89 for (
int i=0; i< nsize; i++) {
90 seedArray[i]= extract<long>(seedList[i]);
93 HepRandom::setTheSeeds(seedArray, aux);
100 const long*
seeds= HepRandom::getTheSeeds();
103 if( seeds[idx]==0)
break;
104 seedList.append(seeds[idx]);
114 HepRandom::getTheTableSeeds(seedPair, index);
117 seedList.append(seedPair[0]);
118 seedList.append(seedPair[1]);
127 HepRandom::saveEngineStatus();
132 HepRandom::saveEngineStatus(filename);
138 HepRandom::restoreEngineStatus();
143 HepRandom::restoreEngineStatus(filename);
149 return RandBit::shootBit();
155 return RandGaussQ::shoot();
160 return RandGaussQ::shoot(mean, stdDev);
167 return G4UniformRand();
179 class_<HepRandom>(
"HepRandom",
"generate random number")
182 .def(init<HepRandomEngine&>())
183 .def(init<HepRandomEngine*>())
187 .staticmethod(
"setTheSeed")
188 .def(
"getTheSeed", &HepRandom::getTheSeed)
189 .staticmethod(
"getTheSeed")
192 .staticmethod(
"setTheSeeds")
194 .staticmethod(
"getTheSeeds")
196 .staticmethod(
"getTheTableSeeds")
198 .def(
"getTheGenerator", &HepRandom::getTheGenerator,
199 return_value_policy<reference_existing_object>())
200 .staticmethod(
"getTheGenerator")
201 .def(
"setTheEngine", &HepRandom::setTheEngine)
202 .staticmethod(
"setTheEngine")
203 .def(
"getTheEngine", &HepRandom::getTheEngine,
204 return_value_policy<reference_existing_object>())
205 .staticmethod(
"getTheEngine")
208 .staticmethod(
"saveEngineStatus")
211 .staticmethod(
"restoreEngineStatus")
212 .def(
"showEngineStatus", &HepRandom::showEngineStatus)
213 .staticmethod(
"showEngineStatus")
214 .def(
"createInstance", &HepRandom::createInstance)
215 .staticmethod(
"createInstance")
219 class_<RandBit, boost::noncopyable>
220 (
"RandBit",
"generate bit random number", no_init)
222 .staticmethod(
"shootBit")
226 class_<G4RandGauss, boost::noncopyable>
227 (
"G4RandGauss",
"generate gaussian random number", no_init)
230 .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)