17 #include "CLHEP/Random/StaticRandomStates.h"
18 #include "CLHEP/Random/RandGauss.h"
19 #include "CLHEP/Random/RandFlat.h"
37 std::ostream & StaticRandomStates::save(std::ostream & os){
38 RandGauss::saveFullState(os);
39 RandFlat::saveDistState(os);
44 std::istream & StaticRandomStates::restore(std::istream & is) {
45 RandGauss::restoreFullState(is);
46 RandFlat::restoreDistState(is);
51 std::istream & StaticRandomStates::restore(std::istream & is) {
52 HepRandomEngine * e = HepRandom::getTheEngine();
53 HepRandomEngine *ne = HepRandomEngine::newEngine(is);
56 if (ne->name() == e->name()) {
58 std::ostringstream os;
60 std::istringstream istst(os.str());
63 std::cerr <<
"???? Unexpected behavior in StaticRandomStates::restore:\n"
64 <<
"The new engine, which had been input successfully from istream\n"
65 <<
"has encountered a problem when used to set state of theEngine\n";
66 is.clear(std::ios::badbit | is.rdstate());
70 HepRandom::setTheEngine(ne);
72 RandGauss::restoreDistState(is);
73 RandFlat::restoreDistState(is);