|
We're glad you came by, but you might find what you're looking for elsewhere. TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it. Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope. |
Generates a random number with the binomial distribution.
randBin(n,p,# simulations)
Press:
- MATH to access the math menu.
- LEFT to access the PRB submenu.
- 7 to select randBin(, or use arrows.
TI-83/84/+/SE
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(NThis 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
.