31 #include <boost/python.hpp>
35 using namespace boost::python;
36 using namespace CLHEP;
41 namespace pyRandomize {
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();
171 using namespace pyRandomize;
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")