Yuki's commands require some randomization. Unfortunately, Javascript's random API is quite limited. It would be good to have a module that offers some more advanced random tools that can be used across the entire application.
The idea is to create a module randtools.js that exposes a few random utilities:
randInt :: (start: Int, end: Int) -> Int
Returns a random integer within the interval [start, end].
choose :: (options: [a]) -> a
Returns a random element from the array options.
Other functions can be implemented if deemed appropriate. Also, notice that there is an implementation for randInt in the module roll.js.
Yuki's commands require some randomization. Unfortunately, Javascript's random API is quite limited. It would be good to have a module that offers some more advanced random tools that can be used across the entire application.
The idea is to create a module
randtools.js
that exposes a few random utilities:randInt :: (start: Int, end: Int) -> Int
Returns a random integer within the interval [start, end].choose :: (options: [a]) -> a
Returns a random element from the arrayoptions
.Other functions can be implemented if deemed appropriate. Also, notice that there is an implementation for
randInt
in the moduleroll.js
.