mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rand: add missing pub modifiers for .byte() and .u32() methods (#13992)
This commit is contained in:
parent
11d9a67e3b
commit
3f90809035
@ -29,7 +29,7 @@ pub fn (mut rng MuslRNG) seed(seed_data []u32) {
|
||||
|
||||
// byte returns a uniformly distributed pseudorandom 8-bit unsigned positive `byte`.
|
||||
[inline]
|
||||
fn (mut rng MuslRNG) byte() byte {
|
||||
pub fn (mut rng MuslRNG) byte() byte {
|
||||
if rng.bytes_left >= 1 {
|
||||
rng.bytes_left -= 1
|
||||
value := byte(rng.buffer)
|
||||
@ -70,7 +70,7 @@ fn temper(prev u32) u32 {
|
||||
}
|
||||
|
||||
// u32 returns a pseudorandom 32-bit unsigned integer (`u32`).
|
||||
fn (mut rng MuslRNG) u32() u32 {
|
||||
pub fn (mut rng MuslRNG) u32() u32 {
|
||||
rng.state = rng.state * 1103515245 + 12345
|
||||
// We are not dividing by 2 (or shifting right by 1)
|
||||
// because we want all 32-bits of random data
|
||||
|
@ -39,7 +39,7 @@ pub fn (mut rng PCG32RNG) seed(seed_data []u32) {
|
||||
|
||||
// byte returns a uniformly distributed pseudorandom 8-bit unsigned positive `byte`.
|
||||
[inline]
|
||||
fn (mut rng PCG32RNG) byte() byte {
|
||||
pub fn (mut rng PCG32RNG) byte() byte {
|
||||
if rng.bytes_left >= 1 {
|
||||
rng.bytes_left -= 1
|
||||
value := byte(rng.buffer)
|
||||
@ -70,7 +70,7 @@ pub fn (mut rng PCG32RNG) u16() u16 {
|
||||
|
||||
// u32 returns a pseudorandom unsigned `u32`.
|
||||
[inline]
|
||||
fn (mut rng PCG32RNG) u32() u32 {
|
||||
pub fn (mut rng PCG32RNG) u32() u32 {
|
||||
oldstate := rng.state
|
||||
rng.state = oldstate * (6364136223846793005) + rng.inc
|
||||
xorshifted := u32(((oldstate >> u64(18)) ^ oldstate) >> u64(27))
|
||||
|
Loading…
Reference in New Issue
Block a user