1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

rand: fix warnings

This commit is contained in:
ka-weihe
2020-06-02 06:39:38 +02:00
committed by GitHub
parent 076089d3c5
commit 13c68eb81e
15 changed files with 90 additions and 448 deletions

View File

@ -204,7 +204,7 @@ pub fn (r SysRNG) intn(max int) int {
eprintln('max has to be positive.')
exit(1)
}
return int(r.u32n(max))
return int(r.u32n(u32(max)))
}
// r.i64n(max) returns a pseudorandom i64 that lies in [0, max)
@ -214,7 +214,7 @@ pub fn (r SysRNG) i64n(max i64) i64 {
eprintln('max has to be positive.')
exit(1)
}
return i64(r.u64n(max))
return i64(r.u64n(u64(max)))
}
// r.int_in_range(min, max) returns a pseudorandom int that lies in [min, max)