⚃ Rolling Dice with JS and Unicode ⚂Posted Wed, Jan 6, 2010 in:
I recently discovered the unicode xscreensaver hack, and have had it running on my secondary monitor for the heck of it. I found out that there are dice face symbols, and I was inspired to do something with them.
Enter number of Dice to roll:
The code is extremely simple, calling Math.floor on the result of Math.random n times, then using a small table of the codepoints from U+2680 to U+2685 to build a string.
Here is the code for anyone interested: