aboutsummaryrefslogtreecommitdiff
path: root/src/random.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2024-06-27 11:40:00 -0400
committerPieter Wuille <pieter@wuille.net>2024-07-01 12:39:53 -0400
commitddc184d999d7e1a87efaf6bcb222186f0dcd87ec (patch)
treeb5f108b5f86a71f952df306ef80fd6af9ee3d652 /src/random.h
parente2d1f84858485650ff743753ffa5c679f210a992 (diff)
random: get rid of GetRand by inlining
Diffstat (limited to 'src/random.h')
-rw-r--r--src/random.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/random.h b/src/random.h
index afbae0cec3..1573e49ef7 100644
--- a/src/random.h
+++ b/src/random.h
@@ -426,20 +426,6 @@ void Shuffle(I first, I last, R&& rng)
}
}
-/** Generate a uniform random integer of type T in the range [0..nMax)
- * Precondition: nMax > 0, T is an integral type, no larger than uint64_t
- */
-template<typename T>
-T GetRand(T nMax) noexcept {
- return T(FastRandomContext().randrange(nMax));
-}
-
-/** Generate a uniform random integer of type T in its entire non-negative range. */
-template<typename T>
-T GetRand() noexcept {
- return T(FastRandomContext().rand<T>());
-}
-
/** Generate a uniform random duration in the range [0..max). Precondition: max.count() > 0 */
template <typename D>
D GetRandomDuration(typename std::common_type<D>::type max) noexcept
@@ -448,7 +434,7 @@ D GetRandomDuration(typename std::common_type<D>::type max) noexcept
// type than the function argument. So std::common_type is used to force the
// call site to specify the type of the return value.
{
- return D{GetRand(max.count())};
+ return D{FastRandomContext().randrange(max.count())};
};
constexpr auto GetRandMicros = GetRandomDuration<std::chrono::microseconds>;
constexpr auto GetRandMillis = GetRandomDuration<std::chrono::milliseconds>;