diff options
| author | Pieter Wuille <[email protected]> | 2017-06-07 11:34:55 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2017-06-07 11:34:55 -0700 |
| commit | 3ecabae36364e905e7821fba3e60aa7f8418de6c (patch) | |
| tree | 04b22d1cf440fcedacdea019f6421c629d766b44 /src/test/coins_tests.cpp | |
| parent | scripted-diff: use insecure_rand256/randrange more (diff) | |
| download | discoin-3ecabae36364e905e7821fba3e60aa7f8418de6c.tar.xz discoin-3ecabae36364e905e7821fba3e60aa7f8418de6c.zip | |
Replace more rand() % NUM by randranges
Diffstat (limited to 'src/test/coins_tests.cpp')
| -rw-r--r-- | src/test/coins_tests.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp index d7b3d194d..c923f8df2 100644 --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test) for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) { // Do a random modification. { - uint256 txid = txids[insecure_rand() % txids.size()]; // txid we're going to modify in this iteration. + uint256 txid = txids[insecure_randrange(txids.size())]; // txid we're going to modify in this iteration. Coin& coin = result[COutPoint(txid, 0)]; const Coin& entry = (insecure_randrange(500) == 0) ? AccessByTxid(*stack.back(), txid) : stack.back()->AccessCoin(COutPoint(txid, 0)); BOOST_CHECK(coin == entry); @@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test) if (insecure_randrange(100) == 0) { // Every 100 iterations, flush an intermediate cache if (stack.size() > 1 && insecure_randrange(2) == 0) { - unsigned int flushIndex = insecure_rand() % (stack.size() - 1); + unsigned int flushIndex = insecure_randrange(stack.size() - 1); stack[flushIndex]->Flush(); } } @@ -434,7 +434,7 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test) if (insecure_randrange(100) == 0) { // Every 100 iterations, flush an intermediate cache if (stack.size() > 1 && insecure_randrange(2) == 0) { - unsigned int flushIndex = insecure_rand() % (stack.size() - 1); + unsigned int flushIndex = insecure_randrange(stack.size() - 1); stack[flushIndex]->Flush(); } } |