Skip to content

Commit a35b682

Browse files
committed
Add assertion to randrange that input is not 0
1 parent 4c1090c commit a35b682

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/random.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class FastRandomContext {
166166
/** Generate a random integer in the range [0..range). */
167167
uint64_t randrange(uint64_t range) noexcept
168168
{
169+
assert(range);
169170
--range;
170171
int bits = CountBits(range);
171172
while (true) {

0 commit comments

Comments
 (0)