slovo/docs/language/examples/supported/random.slo
2026-05-22 08:38:43 +02:00

17 lines
281 B
Plaintext

(module main)
(fn random_i32 () -> i32
(std.random.i32))
(fn random_is_non_negative () -> bool
(if (< (random_i32) 0)
false
true))
(test "random i32 is non-negative"
(random_is_non_negative))
(fn main () -> i32
(std.io.print_bool (random_is_non_negative))
0)