Replace rand() & ((1 << N) - 1) with randbits(N)
Zcash: Excluding changes to tests we don't have. (cherry picked from commit bitcoin/bitcoin@5f0b04eedc)
This commit is contained in:
parent
05c60b2b7e
commit
722d1c4c64
|
@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(pmt_test1)
|
|||
std::vector<bool> vMatch(nTx, false);
|
||||
std::vector<uint256> vMatchTxid1;
|
||||
for (unsigned int j=0; j<nTx; j++) {
|
||||
bool fInclude = (insecure_rand() & ((1 << (att/2)) - 1)) == 0;
|
||||
bool fInclude = insecure_randbits(att / 2) == 0;
|
||||
vMatch[j] = fInclude;
|
||||
if (fInclude)
|
||||
vMatchTxid1.push_back(vTxid[j]);
|
||||
|
|
|
@ -119,7 +119,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle, uint32_t co
|
|||
}
|
||||
tx.nExpiryHeight = (insecure_randrange(2)) ? insecure_randrange(TX_EXPIRY_HEIGHT_THRESHOLD) : 0;
|
||||
} else {
|
||||
tx.nVersion = insecure_rand() & 0x7FFFFFFF;
|
||||
tx.nVersion = insecure_randbits(31);
|
||||
}
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
|
|
Loading…
Reference in New Issue