Getting a percentage from a bunch of random numbers?
Suppose i generate a whole bunch of random numbers and i want to get the percentage of how many times a single number is generated. Here's what i got so far...
Basically i'm generating a bunch of random coin tosses where 1 would be heads and 2 would be tails. How would i get a percentage of the number of times heads shows up in say 40 tries?
int randomcoinflip(int numberofcointosses)
for (i = 0; i < numberofcointosses; i++)