Pierre Angelo

Generation

generate functionWed, 29 Mar 2023

e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them

float P05maxDice(int dice, float faces) { float max = 0; int i = 0; while (i < dice) { float roll = random(faces); if (roll > max) { max = roll; } i++; } return max; }

Questions about programming?Chat with your personal AI assistant