summaryrefslogtreecommitdiff
path: root/libmisc/tests/test_rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmisc/tests/test_rand.c')
-rw-r--r--libmisc/tests/test_rand.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libmisc/tests/test_rand.c b/libmisc/tests/test_rand.c
index 02f4c1c..b98dacf 100644
--- a/libmisc/tests/test_rand.c
+++ b/libmisc/tests/test_rand.c
@@ -53,14 +53,14 @@ static void test_n(uint64_t cnt) {
bool seen[MAX_SEE_ALL] = {0};
for (int i = 0; i < ROUNDS; i++) {
uint64_t val = rand_uint63n(cnt);
- sum += val;
+ sum += (double)val;
test_assert(val < cnt);
if (cnt < MAX_SEE_ALL)
seen[val] = true;
}
if (cnt > 1) {
- test_assert(sum/ROUNDS > 0.45*(cnt-1));
- test_assert(sum/ROUNDS < 0.55*(cnt-1));
+ test_assert(sum/ROUNDS > 0.45*(double)(cnt-1));
+ test_assert(sum/ROUNDS < 0.55*(double)(cnt-1));
}
if (cnt < MAX_SEE_ALL) {
for (uint64_t i = 0; i < cnt; i++)