dicegame/lib/roller.fnl

19 lines
264 B
Plaintext
Raw Permalink Normal View History

2021-10-02 20:47:53 +00:00
;; 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 }