get_distribution() keeps a tally of how many times each face has been rolled, but some users are reporting that they want this same information as a percentage of total rolls.
Change this function to instead have the signature vector<double> GameDie::get_distribution() that returns the decimal of rolls for each face relative to the number of total rolls. Each decimal should be a double between 0 and 1 inclusively. For example, if we have a 4-sided die that has rolled each face 1 time the get_distribution() function should return:
{0.25,0.25,0.25,0.25}
If there are no rolls yet, the function should report 0 for each face in the vector. Otherwise, the percentage should be calculated by face rolls / total rolls.
get_distribution()keeps a tally of how many times each face has been rolled, but some users are reporting that they want this same information as a percentage of total rolls.Change this function to instead have the signature
vector<double> GameDie::get_distribution()that returns the decimal of rolls for each face relative to the number of total rolls. Each decimal should be adoublebetween0and1inclusively. For example, if we have a 4-sided die that has rolled each face 1 time theget_distribution()function should return:{0.25,0.25,0.25,0.25}If there are no rolls yet, the function should report
0for each face in the vector. Otherwise, the percentage should be calculated by face rolls / total rolls.