diff options
author | Pieter Wuille <pieter@wuille.net> | 2024-03-10 23:38:31 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2024-07-01 10:26:46 -0400 |
commit | e2d1f84858485650ff743753ffa5c679f210a992 (patch) | |
tree | 80485673fd7588be09c319ece6a9d05cac6fa17d /src/txrequest.cpp | |
parent | 810cdf6b4e12a1fdace7998d75b4daf8b67d7028 (diff) |
random: make GetRand() support entire range (incl. max)
The existing code uses GetRand(nMax), with a default value for nMax, where nMax is the
range of values (not the maximum!) that the output is allowed to take. This will always
miss the last possible value (e.g. GetRand<uint32_t>() will never return 0xffffffff).
Fix this, by moving the functionality largely in RandomMixin, and also adding a
separate RandomMixin::rand function, which returns a value in the entire (non-negative)
range of an integer.
Diffstat (limited to 'src/txrequest.cpp')
0 files changed, 0 insertions, 0 deletions