26 unsigned int sum = 0U;
27 for (std::vector<unsigned>::const_iterator
i =
seedLengths_.begin(),
35 for (std::vector<unsigned>::const_iterator
i =
stateLengths_.begin(),
44 <<
"RandomEngineStates data is corrupted.\n";
49 std::vector<unsigned>::const_iterator seedLength =
seedLengths_.begin();
50 std::vector<unsigned>::const_iterator seedBegin =
seedVectors_.begin();
51 std::vector<unsigned>::const_iterator seedEnd =
seedVectors_.begin();
53 std::vector<unsigned>::const_iterator stateLength =
stateLengths_.begin();
54 std::vector<unsigned>::const_iterator stateBegin =
stateVectors_.begin();
55 std::vector<unsigned>::const_iterator stateEnd =
stateVectors_.begin();
60 ++
label, ++seedLength, ++stateLength) {
63 seedEnd += *seedLength;
65 stateBegin = stateEnd;
66 stateEnd += *stateLength;
70 std::vector<RandomEngineState>::iterator
state =
71 std::lower_bound(states.begin(), states.end(), randomEngineState);
73 if (state != states.end() && *
label == state->getLabel()) {
74 if (*seedLength != state->getSeed().size() ||
75 *stateLength != state->getState().size()) {
77 <<
"When attempting to replay processing with the RandomNumberGeneratorService,\n"
78 <<
"the engine type for each module must be the same in the replay configuration\n"
79 <<
"and the original configuration. If this is not the problem, then the data\n"
80 <<
"is somehow corrupted or there is a bug because the vector in the data containing\n"
81 <<
"the seeds or engine state is the incorrect size for the type of random engine.\n";
84 state->clearSeedVector();
85 state->reserveSeedVector(*seedLength);
86 for (std::vector<unsigned int>::const_iterator
i = seedBegin;
88 state->push_back_seedVector(*
i);
91 state->clearStateVector();
92 state->reserveStateVector(*stateLength);
93 for (std::vector<unsigned int>::const_iterator
i = stateBegin;
95 state->push_back_stateVector(*
i);
112 std::vector<unsigned>::iterator seedLength =
seedLengths_.begin();
113 std::vector<unsigned>::iterator stateLength =
stateLengths_.begin();
116 for (std::vector<RandomEngineState>::const_iterator
state = states.begin(),
120 *label =
state->getLabel();
122 std::vector<uint32_t>
const& seedVector =
state->getSeed();
123 *seedLength = seedVector.size();
125 for (std::vector<uint32_t>::const_iterator
j = seedVector.begin(),
126 jEnd = seedVector.end();
131 std::vector<uint32_t>
const& stateVector =
state->getState();
132 *stateLength = stateVector.size();
134 for (std::vector<uint32_t>::const_iterator
j = stateVector.begin(),
135 jEnd = stateVector.end();
void getRandomEngineStates(std::vector< RandomEngineState > &states) const
void setLabel(const std::string &value)
std::vector< unsigned > seedLengths_
std::vector< unsigned > seedVectors_
bool isProductEqual(RandomEngineStates const &randomEngineStates) const
std::vector< std::string > moduleLabels_
std::vector< unsigned > stateLengths_
std::vector< unsigned > stateVectors_
void setRandomEngineStates(std::vector< RandomEngineState > const &states)