TI-BASIC:Randbin

From Learn @ Cemetech
Revision as of 18:08, 24 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Command Summary

Generates a random number with the binomial distribution.

Command Syntax

randBin(n,p,# simulations)

Menu Location

Press:

  1. MATH to access the Math menu.
  2. LEFT to access the PRB submenu.
  3. 7 to select randBin(, or use arrows.

Calculator Compatibility

TI-83/84/+/SE

Token Size

2 bytes

randBin(n,p) generates a pseudorandom integer between 0 and n inclusive according to the binomial distribution B(n,p) - that is, n trials of an event with probability of success p are performed, and the number of successes is returned. randBin(n,p,simulations) performs the above calculation simulations times, and returns a list of the results. The expected (average) result is n*p.

n should be an integer greater than or equal to 1, while p should be a real number between 0 and 1 inclusive.

seed→rand affects the output of randBin(

0→rand
     0
randBin(5,1/2
     2
randBin(5,1/2,10
     {3 3 2 4 3 2 2 2 4 3}

Formulas

The value of randBin( for a given seed can be expressed in terms of Rand:

randBin(N,P)=sum(P>rand(N

This is identical to the output of randBin( in the sense that for the same seed, both expressions will generate the same random numbers.

Error Conditions

  • ERR:DOMAIN is triggered if the probability is not on the interval from 0 to 1.

Related Commands