| 61 | |
| 62 | |
| 63 | qreal getRandomReal(qreal min, qreal maxExcl) { |
| 64 | DEMAND( min < maxExcl ); |
| 65 | |
| 66 | // advance RNG on every node, identically |
| 67 | std::uniform_real_distribution<qreal> dist(min,maxExcl); |
| 68 | qreal out = dist(RNG); |
| 69 | |
| 70 | // note despite the doc asserting maxExcl is exclusive, |
| 71 | // uniform_real_distribution() can indeed return it! In that |
| 72 | // case, we substract machine-eps for caller integrity |
| 73 | if (out >= maxExcl) |
| 74 | out = std::nextafter(maxExcl, min); |
| 75 | |
| 76 | DEMAND( out >= min ); |
| 77 | DEMAND( out < maxExcl ); |
| 78 | return out; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | qreal getRandomPhase() { |
no outgoing calls
no test coverage detected