Inside Dice Roller

The Dice Roller class is designed around the idea of quickly implementing a random number generator that can approximate rolling various types of dice.

This project was designed so that it could be compiled and added into any project. There are several different games, and programs in general, that need to use random numbers. Currently we’re working on a large-scale Pathfinder application, and this is just one of those pieces. It has three basic core parts:
  • Roll
    • Rolling dice; it has two optional Parameters: Number of Dice, and Modifier.
  • Roll Multiple Dice – get back individual rolls
    • This returns an array of dice rolls; it gives you the single value of every die roll that was made.
  • Roll Multiple Different Dice
    • This returns a multidimensional array that contains three key pieces of data: [Roll #, [NumberOfSides, Number of Dice rolled, Value of rolled dice]]