mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
ci: fix compilation of term.ui examples on windows
This commit is contained in:
parent
4e2b908f21
commit
dd96852515
3 changed files with 19 additions and 1 deletions
|
@ -71,6 +71,11 @@ pub fn intn(max int) int {
|
||||||
return default_rng.intn(max)
|
return default_rng.intn(max)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// byte returns a uniformly distributed pseudorandom 8-bit unsigned positive `byte`.
|
||||||
|
pub fn byte() byte {
|
||||||
|
return byte(default_rng.intn(256))
|
||||||
|
}
|
||||||
|
|
||||||
// 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)`.
|
||||||
// Both `min` and `max` can be negative, but we must have `min < max`.
|
// Both `min` and `max` can be negative, but we must have `min < max`.
|
||||||
pub fn int_in_range(min int, max int) int {
|
pub fn int_in_range(min int, max int) int {
|
||||||
|
|
|
@ -175,3 +175,16 @@ fn test_rand_f64_in_range() {
|
||||||
assert value < max
|
assert value < max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_rand_byte() {
|
||||||
|
mut all := []byte{}
|
||||||
|
for _ in 0 .. 256 {
|
||||||
|
x := rand.byte()
|
||||||
|
assert x >= 0
|
||||||
|
assert x <= 255
|
||||||
|
all << x
|
||||||
|
}
|
||||||
|
all.sort(a < b)
|
||||||
|
assert all[0] != all[255]
|
||||||
|
assert all[0] != all[128]
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub fn init(cfg Config) &Context {
|
||||||
return &Context{}
|
return &Context{}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut ctx Context) run() {
|
pub fn (mut ctx Context) run() ? {
|
||||||
panic(not_implemented_yet)
|
panic(not_implemented_yet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue