This function takes numTrials random numbers. Then it totals the number of random numbers that are less than prob. It returns that total. While similar to
randInt(0,numTrials), this is much more likely to give a result close to
:randBin(numTrials, prob, numSimulations)
This creates a list of length numSimulations, each element the result of a
This requests a number of coin flips to flip. It then determines how many 50-50 coins would result in heads using randBin. Then it prints the number of heads.