mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rand: update byte() (#8442)
This commit is contained in:
parent
8c70920695
commit
7e3b3a9efc
@ -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)`.
|
||||
|
Loading…
Reference in New Issue
Block a user