summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-random
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-08-17 09:39:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:41 +0900
commit0b22bf4a8926c7987aee63d634be4de8ce9b8e18 (patch)
tree41d65b724d02d0ef09cd550f98c1a5f9cd8d3127 /mrbgems/mruby-random
parent1520c97e172484af7cbd0f51512cd3ac0025e228 (diff)
downloadmruby-0b22bf4a8926c7987aee63d634be4de8ce9b8e18.tar.gz
mruby-0b22bf4a8926c7987aee63d634be4de8ce9b8e18.zip
Fix `rand_real` to return random number `[0,1)` not `[0,1]`.
Diffstat (limited to 'mrbgems/mruby-random')
-rw-r--r--mrbgems/mruby-random/src/random.c2
1 files changed, 1 insertions, 1 deletions
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