25 lines
647 B
Plaintext
25 lines
647 B
Plaintext
fn rollDie(): Int with {Random} = Random.int(1, 6)
|
|
|
|
fn rollDice(count: Int): Unit with {Random, Console} = {
|
|
if count > 0 then {
|
|
let value = rollDie()
|
|
Console.print("Die " + toString(4 - count) + ": " + toString(value))
|
|
rollDice(count - 1)
|
|
} else {
|
|
()
|
|
}
|
|
}
|
|
|
|
fn main(): Unit with {Random, Console, Time} = {
|
|
Console.print("Rolling dice...")
|
|
rollDice(3)
|
|
let coin = Random.bool()
|
|
Console.print("Coin flip: " + toString(coin))
|
|
let f = Random.float()
|
|
Console.print("Random float: " + toString(f))
|
|
let now = Time.now()
|
|
Console.print("Current time: " + toString(now))
|
|
}
|
|
|
|
let output = run main() with {}
|