Good, so 5 dice, each of which has 6 options. if they are not ordered, you have a range of 5-30, as indicated above - it is never enough for 1-100.
You need to accept the order, this gives you a scale of 1,1,1,1,1 - 6,6,6,6,6 (base 6) under the condition 1 โ 0 value, you have a 5-digit base number 6. How we all know 6 ^ 5 = 7776 unique opportunities .;)
For this, I am going to give you a biased random decision.
int total = 0; int[] diceRolls; for (int roll : diceRolls) { total = total*6 + roll - 1; } return total % 100 + 1;
thanks to JosEdu for specifying bracket requirements
In addition, if you want to cancel this offset, you can divide the range by maxval specified in my description above, and then multiply by your total (then add the offset), but you still need to determine which rounding rules you used.
source share