Skip to content

Commit d826444

Browse files
authored
Allow random to work with 0.
1 parent aa334cc commit d826444

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/random.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Random::~Random() { uv_mutex_destroy(&mutex_); }
5353

5454
uint64_t Random::next(uint64_t max) {
5555
ScopedMutex l(&mutex_);
56+
57+
if (max == 0) {
58+
return 0;
59+
}
60+
5661
const uint64_t limit = CASS_UINT64_MAX - CASS_UINT64_MAX % max;
5762
uint64_t r;
5863
do {

0 commit comments

Comments
 (0)