19 lines
264 B
Plaintext
19 lines
264 B
Plaintext
|
;; dice-roller.fnl
|
||
|
(math.randomseed (os.time))
|
||
|
|
||
|
(fn roll []
|
||
|
"Return a random number between 1 and 6"
|
||
|
(math.random 1 6)
|
||
|
)
|
||
|
|
||
|
(fn rolls []
|
||
|
"Return a table of 3 random numbers"
|
||
|
(local t [])
|
||
|
(for [i 1 3]
|
||
|
(table.insert t (roll))
|
||
|
)
|
||
|
t
|
||
|
)
|
||
|
|
||
|
{: rolls }
|