package eu.smoser.dungeongenerator.util;

import java.util.Random;

/**
 * This class gives random dices
 * @author MrMcX
 */
public class Dice {

    /**
     * Rolls a dice somes times, adds everything up and returns it
     * @param sides Number of sides of the dice
     * @param times Number of times to roll the dice
     * @return Sum of results
     */
    public static int Roll(int sides, int times){
        Random r = new Random();
        int sum = 0;
        for(int i = 0; i < times; i++){
            sum += r.nextInt(sides)+1;
        }
        return sum;
    }
}
