MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / getRandomSubRange

Function getRandomSubRange

tests/utils/random.cpp:146–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145
146vector<int> getRandomSubRange(int start, int endExcl, int numElems) {
147 DEMAND( endExcl >= start );
148 DEMAND( numElems >= 1 );
149 DEMAND( numElems <= endExcl - start );
150
151 // shuffle entire range (advances RNG on every node, identically)
152 vector<int> range = getRange(start, endExcl);
153 std::shuffle(range.begin(), range.end(), RNG);
154
155 // return first subrange
156 return vector<int>(range.begin(), range.begin() + numElems);
157}
158
159
160vector<qreal> getRandomProbabilities(int numProbs) {

Callers 3

SECTIONFunction · 0.85

Calls 1

getRangeFunction · 0.85

Tested by

no test coverage detected