From d826444b2c55352d35770629bf2df99b878f4f66 Mon Sep 17 00:00:00 2001 From: Joey Date: Fri, 2 Aug 2019 17:13:44 +0100 Subject: [PATCH] Allow random to work with 0. --- src/random.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/random.cpp b/src/random.cpp index 8ca8baf86..ccc6b2235 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -53,6 +53,11 @@ Random::~Random() { uv_mutex_destroy(&mutex_); } uint64_t Random::next(uint64_t max) { ScopedMutex l(&mutex_); + + if (max == 0) { + return 0; + } + const uint64_t limit = CASS_UINT64_MAX - CASS_UINT64_MAX % max; uint64_t r; do {