From 7e3b3a9efc5bf11694da72330da0ce20ad5966f9 Mon Sep 17 00:00:00 2001 From: Subhomoy Haldar Date: Sat, 30 Jan 2021 18:49:14 +0530 Subject: [PATCH] rand: update byte() (#8442) --- vlib/rand/rand.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/rand/rand.v b/vlib/rand/rand.v index 0814a3f312..dd5b0da90c 100644 --- a/vlib/rand/rand.v +++ b/vlib/rand/rand.v @@ -73,7 +73,7 @@ pub fn intn(max int) int { // byte returns a uniformly distributed pseudorandom 8-bit unsigned positive `byte`. pub fn byte() byte { - return byte(default_rng.intn(256)) + return byte(default_rng.u32() & 0xff) } // int_in_range returns a uniformly distributed pseudorandom 32-bit signed int in range `[min, max)`.