Skip to content

Commit 50acc6a

Browse files
authored
Merge pull request #452 from joeyhub/master
Allow random to work with 0.
2 parents d7de026 + d826444 commit 50acc6a

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)