24 unsigned int sum = 0
U;
44 std::vector<unsigned>::const_iterator seedLength =
seedLengths_.begin();
45 std::vector<unsigned>::const_iterator seedBegin =
seedVectors_.begin();
46 std::vector<unsigned>::const_iterator seedEnd =
seedVectors_.begin();
48 std::vector<unsigned>::const_iterator stateLength =
stateLengths_.begin();
49 std::vector<unsigned>::const_iterator stateBegin =
stateVectors_.begin();
50 std::vector<unsigned>::const_iterator stateEnd =
stateVectors_.begin();
54 ++
label, ++seedLength, ++stateLength) {
56 seedEnd += *seedLength;
58 stateBegin = stateEnd;
59 stateEnd += *stateLength;
63 std::vector<RandomEngineState>::iterator state =
64 std::lower_bound(states.begin(), states.end(), randomEngineState);
66 if (state != states.end() && *
label == state->getLabel()) {
67 if (*seedLength != state->getSeed().size() || *stateLength != state->getState().size()) {
69 <<
"When attempting to replay processing with the RandomNumberGeneratorService,\n" 70 <<
"the engine type for each module must be the same in the replay configuration\n" 71 <<
"and the original configuration. If this is not the problem, then the data\n" 72 <<
"is somehow corrupted or there is a bug because the vector in the data containing\n" 73 <<
"the seeds or engine state is the incorrect size for the type of random engine.\n";
76 state->clearSeedVector();
77 state->reserveSeedVector(*seedLength);
78 for (std::vector<unsigned int>::const_iterator
i = seedBegin;
i != seedEnd; ++
i) {
79 state->push_back_seedVector(*
i);
82 state->clearStateVector();
83 state->reserveStateVector(*stateLength);
84 for (std::vector<unsigned int>::const_iterator
i = stateBegin;
i != stateEnd; ++
i) {
85 state->push_back_stateVector(*
i);
99 std::vector<unsigned>::iterator seedLength =
seedLengths_.begin();
100 std::vector<unsigned>::iterator stateLength =
stateLengths_.begin();
102 for (std::vector<RandomEngineState>::const_iterator state = states.begin(), iEnd = states.end(); state != iEnd;
103 ++state, ++
label, ++seedLength, ++stateLength) {
104 *label = state->getLabel();
106 std::vector<uint32_t>
const& seedVector = state->getSeed();
107 *seedLength = seedVector.size();
109 for (std::vector<uint32_t>::const_iterator j = seedVector.begin(), jEnd = seedVector.end(); j != jEnd; ++j) {
113 std::vector<uint32_t>
const& stateVector = state->getState();
114 *stateLength = stateVector.size();
116 for (std::vector<uint32_t>::const_iterator j = stateVector.begin(), jEnd = stateVector.end(); j != jEnd; ++j) {
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)