mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check (mut f Foo) syntax
This commit is contained in:
@@ -33,7 +33,7 @@ pub fn new_pcg32(initstate u64, initseq u64) Pcg32 {
|
||||
|
||||
|
||||
[inline]
|
||||
pub fn (rng mut Pcg32) next() u32 {
|
||||
pub fn (mut rng Pcg32) next() u32 {
|
||||
oldstate := rng.state
|
||||
rng.state = oldstate * (6364136223846793005) + rng.inc
|
||||
xorshifted := u32(((oldstate>>u64(18)) ^ oldstate)>>u64(27))
|
||||
@@ -49,7 +49,7 @@ pub fn (rng mut Pcg32) next() u32 {
|
||||
|
||||
|
||||
[inline]
|
||||
pub fn (rng mut Pcg32) bounded_next(bound u32) u32 {
|
||||
pub fn (mut rng Pcg32) bounded_next(bound u32) u32 {
|
||||
// To avoid bias, we need to make the range of the RNG a multiple of
|
||||
// bound, which we do by dropping output less than a threshold.
|
||||
threshold := (-bound % bound)
|
||||
@@ -66,4 +66,3 @@ pub fn (rng mut Pcg32) bounded_next(bound u32) u32 {
|
||||
}
|
||||
return u32(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn new_splitmix64(seed u64) Splitmix64 {
|
||||
|
||||
|
||||
[inline]
|
||||
pub fn (rng mut Splitmix64) next() u64 {
|
||||
pub fn (mut rng Splitmix64) next() u64 {
|
||||
rng.state += (0x9e3779b97f4a7c15)
|
||||
mut z := rng.state
|
||||
z = (z ^ ((z>>u64(30)))) * (0xbf58476d1ce4e5b9)
|
||||
@@ -40,7 +40,7 @@ pub fn (rng mut Splitmix64) next() u64 {
|
||||
|
||||
|
||||
[inline]
|
||||
pub fn (rng mut Splitmix64) bounded_next(bound u64) u64 {
|
||||
pub fn (mut rng Splitmix64) bounded_next(bound u64) u64 {
|
||||
threshold := -bound % bound
|
||||
for {
|
||||
r := rng.next()
|
||||
@@ -50,4 +50,3 @@ pub fn (rng mut Splitmix64) bounded_next(bound u64) u64 {
|
||||
}
|
||||
return u64(0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user