In this exercise you have to create a Die module in a file called die.ex with one function roll/0 that simply returns a number between 1 and 6.
Put the file in the same directory as the coin.ex and stats.ex files as we will be needing them.
Hint: use :random:uniform/1 from the Erlang libraries for the easy solution or :random:uniform/0 and trunc/1 for the more complicated solution.
You can compile your module in one of two ways.
Command Line Compiling
$ elixirc die.ex $ ls coin.ex die.ex Elixir.Coin.beam Elixir.Die.beam Elixir.Stats.beam stats.ex
Compiling in the interactive shell
You then start the iex shell from the command line and do the following:
iex(1)> c("die.ex") [Die]
Throwing the die
Here is some sample output of how it should work:
iex(2)> Die.roll() 3 iex(3)> Die.roll() 5 iex(4)> Die.roll() 6
Sample the die
Try using the Stats.sample/2 function to sample 10 rolls of your die.