From 0b22bf4a8926c7987aee63d634be4de8ce9b8e18 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 17 Aug 2020 09:39:25 +0900 Subject: Fix `rand_real` to return random number `[0,1)` not `[0,1]`. --- mrbgems/mruby-random/src/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mrbgems/mruby-random/src/random.c') diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c index 3010b3db7..406738374 100644 --- a/mrbgems/mruby-random/src/random.c +++ b/mrbgems/mruby-random/src/random.c @@ -90,7 +90,7 @@ static double rand_real(rand_state *t) { uint32_t x = rand_uint32(t); - return x*(1.0/4294967295.0); + return x*(1.0/4294967296.0); } #endif -- cgit v1.2.3