randFromArray(["bag", "jar", "box", "cup"])
randFromArray(["marble", "ball", "jelly bean"])
randRange(3, 11)
randRange(3, 11)
randRange(3, 11)
RED + GREEN + BLUE
rand(2) == 0
randFromArray([["red", RED], ["green", GREEN], ["blue", BLUE]])
NOT ? TOTAL - CHOSEN_NUMBER : CHOSEN_NUMBER
A CONTAINER contains RED
red MARBLEs,
GREEN
green MARBLEs, and BLUE
blue MARBLEs.
If a MARBLE is randomly chosen, what is the probability
that it is not CHOSEN_COLOR? Write your answer as a simplified fraction.
NUMBER / TOTAL
There are RED + GREEN + BLUE = TOTAL
MARBLEs in the CONTAINER.
There are CHOSEN_NUMBER
CHOSEN_COLOR MARBLEs.
That means TOTAL - CHOSEN_NUMBER = NUMBER
are not CHOSEN_COLOR.
The probability is \displaystyle fractionSimplification(NUMBER, TOTAL)
.
randFromArray([
["a 1", [1]],
["a 2", [2]],
["a 3", [3]],
["a 4", [4]],
["a 5", [5]],
["a 6", [6]],
["at least 2", [2, 3, 4, 5, 6]],
["at least 3", [3, 4, 5, 6]],
["at least 4", [4, 5, 6]],
["more than 2", [3, 4, 5, 6]],
["more than 3", [4, 5, 6]],
["more than 4", [5, 6]],
["less than 4", [1, 2, 3]],
["less than 5", [1, 2, 3, 4]],
["less than 6", [1, 2, 3, 4, 5]],
["even", [2, 4, 6]],
["even", [2, 4, 6]],
["odd", [1, 3, 5]],
["odd", [1, 3, 5]],
["prime", [2, 3, 5]]
])
RESULT_POSSIBLE.length
A fair six-sided die is rolled. What is the probability that the
result is RESULT_DESC? Write your answer as a simplified fraction.
RESULT_COUNT / 6
When rolling a die, there are 6
possibilities: 1, 2, 3, 4, 5, and 6.
In this case, only 1
result is favorable: the number RESULT_POSSIBLE[0].
In this case, RESULT_COUNT
results are favorable: toSentence(RESULT_POSSIBLE).
The probability is \displaystyle fractionSimplification(RESULT_COUNT, 6)
.
randFromArray([
[3, "no heads", [0]],
[3, "heads exactly once", [1]],
[3, "heads exactly twice", [2]],
[3, "heads at least once", [1, 2, 3]],
[3, "heads at least twice", [2, 3]],
[3, "heads every time", [3]],
[4, "no heads", [0]],
[4, "heads exactly once", [1]],
[4, "heads exactly twice", [2]],
[4, "exactly three heads", [3]],
[4, "heads at least once", [1, 2, 3, 4]],
[4, "heads at least twice", [2, 3, 4]],
[4, "at least three heads", [3, 4]],
[4, "heads every time", [4]],
[3, "no tails", [3]],
[3, "tails exactly once", [2]],
[3, "tails exactly twice", [1]],
[3, "tails at least once", [0, 1, 2]],
[3, "tails at least twice", [0, 1]],
[3, "tails every time", [0]],
[4, "no tails", [4]],
[4, "tails exactly once", [3]],
[4, "tails exactly twice", [2]],
[4, "exactly three tails", [1]],
[4, "tails at least once", [0, 1, 2, 3]],
[4, "tails at least twice", [0, 1, 2]],
[4, "at least three tails", [0, 1]],
[4, "tails every time", [0]]
])
coinFlips(REPS)
(function() {
return jQuery.map(ALL, function( el, i ) {
return el[0];
});
})()
(function() {
return jQuery.map(jQuery.grep(ALL, function( el, i ) {
return WANTED.indexOf(el[1]) !== -1;
}), function( el, i ) {
return el[0];
});
})()
choose(REPS, WANTED)
pow(2, REPS)
A fair coin is flipped REPS == 3 ? "three" : "four" times. What is the
probability of getting DESC? Write your answer as a simplified fraction.
WANTED_COUNT / TWO_TO_REPS
There are (new Array(REPS)).join("2 \\cdot ")2 = 2^{REPS} = TWO_TO_REPS
possibilities for the sequence of flips.
The possibilities are toSentence(ALL_SEQS).
There WANTED_COUNT == 1 ? "is only" : "are" plural(WANTED_COUNT, "favorable outcome"): toSentence(WANTED_LIST).
The probability is \displaystyle fractionSimplification(WANTED_COUNT, TWO_TO_REPS)
.
randFromArray([ [1, 10], [11, 20], [21, 30], [31, 40], [41, 50], [51, 60], [61, 70], [71, 80], [81, 90], [91, 100] ])
(function() {
var list = [];
for (var i = LOW; i <= HIGH; i++) {
list.push(i);
}
return list;
})()
randFromArray([
["prime", KhanUtil.isPrime],
["divisible by both 2 and 3", function(n) { return n % 6 <= 0.5; }],
["divisible by either 3 or 5", function(n) { return n % 3 <= 0.5 || n % 5 <= 0.5; }],
["divisible by either 4 or 7", function(n) { return n % 4 <= 0.5 || n % 7 <= 0.5; }]
])
jQuery.grep(POSSIBLE, COND_FN)
WANTED_LIST.length
A positive integer is picked randomly from LOW to HIGH, inclusive.
What is the probability that it is COND_DESC? Write your answer as a simplified fraction.
WANTED_COUNT / POSSIBLE.length
There are POSSIBLE.length possibilities for the chosen number.
The possibilities are toSentence(POSSIBLE).
There WANTED_COUNT == 1 ? "is only" : "are" plural(WANTED_COUNT, "favorable outcome"): toSentence(WANTED_LIST).
The probability is \displaystyle fractionSimplification(WANTED_COUNT, POSSIBLE.length)
.