I'd like to make a simple dice roller to be used in board games. A simple way to simulate a roll is:
d[n_] := RandomChoice[Range[n]]
Now, calling d[6] will roll a 6-sided die, and d[20] a 20 sided-die. To avoid typing the command each time, it can be made into a button:
Button["d20", Echo@d[20]]
I wanted to build a Button table to simulate the classic range of d4, d6, d8, d10, d12 and d20. My initial try of:
Table[Button["d" <> ToString[k], Echo@d[k]], {k, {4, 6, 8, 10, 12, 20}}]
fails to run. I got no better result with:
ButtonBar[Table["d" <> ToString[k] :> d[k], {k, {4, 6, 8, 10, 12, 20}}]]
How can I generate this list ?