test: refactor: Accept any RandomNumberGenerator in RandMoney

Accepting any Rng in RandMoney makes tests more flexible to use a
different Rng. Also, passing in the Rng clarifies the call sites, so
that they all use g_rand_ctx explicitly and consistently.
This commit is contained in:
MarcoFalke
2024-08-02 12:30:13 +02:00
parent 68f77dd21e
commit fa54cab473
4 changed files with 7 additions and 6 deletions

View File

@@ -182,7 +182,7 @@ void SimulationTest(CCoinsView* base, bool fake_best_block)
if (InsecureRandRange(5) == 0 || coin.IsSpent()) {
Coin newcoin;
newcoin.out.nValue = InsecureRandMoneyAmount();
newcoin.out.nValue = RandMoney(m_rng);
newcoin.nHeight = 1;
// Infrequently test adding unspendable coins.