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

Function getRandomProbabilities

tests/utils/random.cpp:160–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158
159
160vector<qreal> getRandomProbabilities(int numProbs) {
161
162 vector<qreal> probs(numProbs, 0);
163
164 // generate random unnormalised scalars
165 for (auto& p : probs)
166 p = getRandomReal(0, 1);
167
168 // normalise
169 qreal total = 0;
170 for (auto& p : probs)
171 total += p;
172
173 for (auto& p : probs)
174 p /= total;
175
176 return probs;
177}
178
179
180listpair getRandomFixedNumCtrlsTargs(int numQubits, int numCtrls, int numTargs) {

Callers 3

getRandomDensityMatrixFunction · 0.70
SECTIONFunction · 0.50
SECTIONFunction · 0.50

Calls 1

getRandomRealFunction · 0.70

Tested by

no test coverage detected