Thanks for the link.
The function used on the referred page is:
function rollDice(N, S):
# Sum of N dice each of which goes from 0 to S
value = 0
for 0 ≤ i < N:
value += random(S+1)
return value
I assume that an equivalent Processing code would be something like this:
float value;
void rollDice(int N, float S) {
value = 0;
for (int i = 0; i < N; i++) {
value += random(S+1);
}
}
I’ve experimented some different codes to implement this function,
But it still doesn’t make sense to me.