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

Function setRandomTestStateSeeds

tests/deprecated/test_utilities.cpp:197–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void setRandomTestStateSeeds() {
198
199 // must seed both rand() and this C++ generator (used for shuffling)
200
201 // obtain a seed from hardware
202 std::random_device cspnrg;
203 unsigned seed = cspnrg();
204
205 // broadcast to ensure node consensus
206#if COMPILE_MPI
207 int sendRank = 0;
208 MPI_Bcast(&seed, 1, MPI_UNSIGNED, sendRank, MPI_COMM_WORLD);
209#endif
210
211 // initilise both C (rand()) and C++ (randomGenerator) RNGs
212 srand(seed);
213 randomGenerator.seed(seed);
214}
215
216void assertQuregAndRefInDebugState(Qureg qureg, QVector ref) {
217 DEMAND( qureg.isDensityMatrix == 0 );

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected