TI-BASIC Wiki
Advertisement


: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[]

  • MATH
  • PROB
  • 7:randBin(

Example[]

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.

Advertisement