4 #include "CLHEP/Random/engineIDulong.h" 6 #include "TBufferFile.h" 20 theSeed =
trand_->GetSeed();
35 std::vector<unsigned long>
v;
37 int32_t itemSize =
sizeof(uint32_t);
38 TBufferFile
buffer(TBuffer::kWrite, 2048 * itemSize);
41 char* bufferPtr =
buffer.Buffer();
42 int32_t numItems = (
buffer.Length() + itemSize - 1) / itemSize;
43 v.reserve(numItems + 1);
44 v.push_back(CLHEP::engineIDulong<TRandomAdaptor>());
45 for (
int i = 0;
i < numItems; ++
i) {
54 uint32_t value32 = *
reinterpret_cast<uint32_t*
>(bufferPtr +
i * itemSize);
56 if (
i == numItems - 1) {
57 int nBytes =
buffer.Length() % itemSize;
67 v.push_back(static_cast<unsigned long>(value32));
74 theSeed =
trand_->GetSeed();
81 theSeed =
trand_->GetSeed();
97 if (
v[0] != CLHEP::engineIDulong<TRandomAdaptor>())
99 int32_t numItems =
v.size() - 1;
101 int32_t itemSize =
sizeof(uint32_t);
102 TBufferFile
buffer(TBuffer::kRead, numItems * itemSize + 1024);
103 char* bufferPtr =
buffer.Buffer();
104 for (int32_t
i = 0;
i < numItems; ++
i) {
105 *
reinterpret_cast<uint32_t*
>(bufferPtr +
i * itemSize) = static_cast<uint32_t>(
v[
i + 1] & 0xffffffff);
120 std::ostringstream sstr;
121 sstr <<
"Unimplemented Feature: " << errortext <<
'\n';
void setSeed(long seed, int) override
std::vector< unsigned long > put() const override
void Grumble(std::string const &errortext) const
void setSeeds(long const *seeds, int) override
~TRandomAdaptor() override
std::istream & getState(std::istream &is) override
std::istream & get(std::istream &is) override