rand: update byte() (#8442)
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`.
|
// byte returns a uniformly distributed pseudorandom 8-bit unsigned positive `byte`.
|
||||||
pub fn byte() 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)`.
|
// int_in_range returns a uniformly distributed pseudorandom 32-bit signed int in range `[min, max)`.
|
||||||
|
|
Loading…
Reference in New Issue