33 #include <boost/python.hpp>
37 using namespace boost::python;
38 using namespace CLHEP;
43 namespace pyRandomize {
49 HepRandom::setTheSeed(seed);
54 HepRandom::setTheSeed(seed, lux);
63 long val= extract<long>(seedList[idx]);
69 long* seedArray=
new long[nsize];
71 for (
int i=0; i< nsize; i++) {
72 seedArray[i]= extract<long>(seedList[i]);
75 HepRandom::setTheSeeds(seedArray);
83 long val= extract<long>(seedList[idx]);
89 long* seedArray=
new long[nsize];
90 for (
int i=0; i< nsize; i++) {
91 seedArray[i]= extract<long>(seedList[i]);
94 HepRandom::setTheSeeds(seedArray, aux);
101 const long* seeds= HepRandom::getTheSeeds();
104 if( seeds[idx]==0)
break;
105 seedList.append(seeds[idx]);
115 HepRandom::getTheTableSeeds(seedPair, index);
118 seedList.append(seedPair[0]);
119 seedList.append(seedPair[1]);
128 HepRandom::saveEngineStatus();
133 HepRandom::saveEngineStatus(filename);
139 HepRandom::restoreEngineStatus();
144 HepRandom::restoreEngineStatus(filename);
150 return RandBit::shootBit();
156 return RandGaussQ::shoot();
161 return RandGaussQ::shoot(mean, stdDev);
173 using namespace pyRandomize;
180 class_<HepRandom>(
"HepRandom",
"generate random number")
183 .def(init<HepRandomEngine&>())
184 .def(init<HepRandomEngine*>())
188 .staticmethod(
"setTheSeed")
189 .def(
"getTheSeed", &HepRandom::getTheSeed)
190 .staticmethod(
"getTheSeed")
193 .staticmethod(
"setTheSeeds")
195 .staticmethod(
"getTheSeeds")
197 .staticmethod(
"getTheTableSeeds")
199 .def(
"getTheGenerator", &HepRandom::getTheGenerator,
200 return_value_policy<reference_existing_object>())
201 .staticmethod(
"getTheGenerator")
202 .def(
"setTheEngine", &HepRandom::setTheEngine)
203 .staticmethod(
"setTheEngine")
204 .def(
"getTheEngine", &HepRandom::getTheEngine,
205 return_value_policy<reference_existing_object>())
206 .staticmethod(
"getTheEngine")
209 .staticmethod(
"saveEngineStatus")
212 .staticmethod(
"restoreEngineStatus")
213 .def(
"showEngineStatus", &HepRandom::showEngineStatus)
214 .staticmethod(
"showEngineStatus")
215 .def(
"createInstance", &HepRandom::createInstance)
216 .staticmethod(
"createInstance")
220 class_<RandBit, boost::noncopyable>
221 (
"RandBit",
"generate bit random number", no_init)
223 .staticmethod(
"shootBit")
227 class_<G4RandGauss, boost::noncopyable>
228 (
"G4RandGauss",
"generate gaussian random number", no_init)
231 .staticmethod(
"shoot")