32 #include <boost/python.hpp>
36 using namespace boost::python;
37 using namespace CLHEP;
42 namespace pyRandomize {
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();
172 using namespace pyRandomize;
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)
static constexpr double lux
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)
ThreeVector shoot(const G4int Ap, const G4int Af)
void f1_restoreEngineStatus()
int f1_RandBit_shootBit()
void f2_restoreEngineStatus(const char *filename)
double f2_RandGaussQ_shoot(double mean, double stdDev)
void f2_setTheSeeds(const list &seedList, int aux)