Avalander / yuki

1 stars 0 forks source link

Randtools module #13

Closed Avalander closed 5 years ago

Avalander commented 5 years ago

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.