FANDOM



:randBin(numTrials, prob)

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 numTrials*prob.

:randBin(numTrials, prob, numSimulations)

This creates a list of length numSimulations, each element the result of a randBin(numTrials, prob).

Location Edit

  • MATH
  • PROB
  • 7:randBin(

Example Edit

PROGRAM:COINFLP
:Input "COIN FLIPS?",F
:randBin(F,.5)→H
:Disp "HEADS: ",H

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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.