Save by clicking here (with the right mouse button) the file on your computer (change the name if you want, but leave ".htm").
At this point you can use it to calculate any probability.
Just open the source code, edit TruthValue, and run "save".  You can repeat this several times.

 

First example  (incorporated in the initial version of the script)
In a dice game players throw three dice; who first gets at least 2 equal numbers wins. What is the probability of getting this in a throw?

function TruthValue()
{ with(Math) {
/// the current event is: I throw three dice.
/// What is the probability of getting at least 2 equal numbers?

///--------

U1 = floor(random()*6+1);
U2 = floor(random()*6+1);
U3 = floor(random()*6+1);
V=0;
if (U1==U2) { V = 1};
if (U1==U3) { V = 1};
if (U2==U3) { V = 1};

///--------
}}

I have (with "n+": 10000, 10000, 20000, 40000, ...):
n=10240000 44.443642578125% +/- 0.046584667751577526%
n=5120000 44.41736328125% +/- 0.06587676682454288%
n=2560000 44.437421875% +/- 0.09316804416641197%
n=1280000 44.4278125%  +/- 0.13175668240289726%
n=640000 44.41859375% +/- 0.18632827992836345%
n=320000 44.4684375% +/- 0.2635377451554643%
n=160000 44.32375%  +/- 0.37257684179693506%
n=80000 44.25125% +/- 0.5268164338326546%
n=40000 44.0025% +/- 0.7445942580419068%
n=20000 44.125% +/- 1.0533391879742468%
n=10000 44.23% +/- 1.4900531587301118%

I get an estimate of the probability, which can help me to check the possible solution found theoretically (in this case I know how to find it:
        it is  0.444 ... = 1−5/6*4/6 = 4/9.  Why?).

[I reflect. The probability that the 2nd output is different from the first one is 5/6. The probablity that the third output is different from the first two is 4/6. The probablity that the 3 outputs are different is 5/6*4/6. So the probability that at least 2 are equal is:  1−5/6*4/6 = 4/9]

Second example
In a certain population of adults in a given region, a particular childhood disease is known to affect 1 in 8 people.  If you consider 100 adult people from that region, calculate the probability that no more than 10 have been affected by it.

function TruthValue()
{ with(Math) {

V = 0; P = 1/8; N = 100; k = 0
for(i=1; i <= N; i++) {if(random() < P) {k = k+1} }
if(k < 11) {V = 1}

}}

n=640000 28.09109375% +/- 0.16854166235983364%
n=320000 28.0340625% +/- 0.2382064168558167%
n=160000 27.92% +/- 0.336455565438695%
n=80000 28.0175% +/- 0.4763291159111611%
n=40000 27.9825% +/- 0.6733780639760818%
n=20000 27.905% +/- 0.9515041811575701%
n=10000 27.61% +/- 1.3412676876377028%

The probability if 28.1%.  It is demonstrable (how?) that the probability is 28.09992%.

Third example
The probability (by drawing 10 cards from a 40-pack deck) to get at least a tris (ie 3 or 4 cards of the same value).

I put in random order the first 40 positive integers in C.  I consider the numbers from 1 to 10, ..., from 31 to 40 if they were the cards of the same suit.  If C is 37 or 17 ... C%10 is 7.  I start from a low value of n.

[X%N  (or  X modulo N  or X mod N)  is the remainder of the division of X by N]
function TruthValue()
{ with(Math) {

var C = new Array(40); var N = new Array(10);
C[1]=floor(random()*40+1);
for(i=2; i <= 40; i++)
  { U=0; while(U < 1) { C[i]=floor(random()*40+1); U=1; for(j=1; j < i; j++) { if(C[j]==C[i]) {U=0} } } }
V=0; for(i=1; i<=10; i++) {N[i]=0};
i=1; while(i<11) { x=1+C[i]%10; N[x]=N[x]+1; if(N[x]==3) {i=11; V=1} else {i=i+1}  }

}}

n=256000 38.399609375% +/- 0.2883747669871522%
n=128000 38.51328125% +/- 0.4080504730615265%
n=64000 38.578125% +/- 0.5772537376074992%
n=32000 39.0125% +/- 0.818041540542717%
n=16000 39.5% +/- 1.1594474524098457%
n=8000 39.575% +/- 1.6402958934906455%
n=4000 38.85% +/- 2.312273994957548%
n=2000 38.7% +/- 3.2681394351654953%
n=1000 37.4% +/- 4.592630210701952%

It is not easy to find the exact value;  with the script you can arrive for example to 38.452% +/− 0.129%  (or, if you have time, to 38.436% +/− 0.047%).

Fourth example
A matched die gives 1, 2, 3, 4, 5, 6 with, in order, the (rounded) probabilities 0.125, 0.170, 0.240, 0.170, 0.125, 0.170.  What is the probability that, if you roll it, you get a multiple of 3?

It is easy to understand that the probability is 0.240 + 0.170 = 0.410. Anyway ...

function TruthValue()
{ with(Math) {

U0 = random();
U=6
if (U0<0.125+0.17+0.24+0.17+0.125) {U=5};
if (U0<0.125+0.17+0.24+0.17) {U=4};
if (U0<0.125+0.17+0.24) {U=3};
if (U0<0.125+0.17) {U=2};
if (U0<0.125) {U=1};
V=0;
if (U==3) { V = 1};
if (U==6) { V = 1};

}}
n=10240000 40.995830078125% +/- 0.04610865907417184%
n=5120000 41.00162109375% +/- 0.06520889936050078%
n=2560000 41.0290234375% +/- 0.09222870418525478%
n=1280000 41.019921875% +/- 0.13042670589904629%
n=640000 40.95609375% +/- 0.18440742868955048%
n=320000 40.96875% +/- 0.26080402562123445%
n=160000 40.9525% +/- 0.3688107637658629%
n=80000 41.14375% +/- 0.521947961404103%
n=40000 40.8% +/- 0.7372038976698838%
n=20000 40.485% +/- 1.041303685011352%
n=10000 41.06% +/- 1.4759019576716015%

from which I could deduce that the probability is 40.1% ± 0.05%.

Fifth example
I have three sticks of the same length. I break the three sticks "completely at random" and take a part of each one at random. What is the probability with which I can construct a triangle that has these three parts as sides?

 

function TruthValue()
{ with(Math) {

U1 = random(); U2 = random(); U3 = random();
V=0;
if (U1+U2<U3) { V = 1};
if (U1+U3<U2) { V = 1};
if (U2+U3<U1) { V = 1};

}}

n=81920000 50.00080810546875% +/- 0.01657281528304762%
n=40960000 49.9852685546875% +/- 0.0234374992688422%
n=20480000 49.981855468750005% +/- 0.033145628994871314%
n=10240000 49.997451171875% +/- 0.046875002227913604%
n=5120000 49.974140625000004% +/- 0.06629125834410458%
n=2560000 50.00328125% +/- 0.09375001810867843%
n=1280000 50.028046875% +/- 0.13258255240394223%
n=640000 50.04765625% +/- 0.18750006131752964%
n=320000 50.01625% +/- 0.26516544326225494%
n=160000 50.040625% +/- 0.37500104810078905%
n=80000 50.135% +/- 0.530331467415254%
n=40000 50.18759% +/- 0.7500041016538258%
n=20000 50.105% +/- 1.0606843504617978%
n=10000 49.67% +/- 1.5000423336360444%

If I stop here, I can conclude that the probability is 50.00% ± 0.02%

It can be shown that the probability is exactly 1/2.

Sixth example
I throw a balanced coin 200 times. What is the probability of 100 heads?

function TruthValue()
{ with(Math) {

Head=0
for (var Number=0; Number < 200; Number++)
{
if (random()>0.5) {Head=Head+1;}
}
V=0
if(Head==100) {V=1}

}}

n=2560000 5.662578125% +/- 0.04333616359043924%
n=1280000 5.659296875% +/- 0.06126990857205131%
n=640000 5.64953125% +/- 0.0865784578316723%
n=320000 5.6484375% +/- 0.12242938172716718%
n=160000 5.6175% +/- 0.17269505398482882%
n=80000 5.58125% +/- 0.24348591133078207%
n=40000 5.4875% +/- 0.3416084304459475%
n=20000 5.525% +/- 0.48466505316629543%
n=10000 5.32% +/- 0.6733299171414647%

If I stop here, I can conclude that the probability is 5.66% ± 0.05%

What is the probability of 105 heads?

function TruthValue()
{ with(Math) {

Head=0
for (var Number=0; Number < 200; Number++)
{
if (random()>0.5) {Head=Head+1;}
}
V=0
if(Head==105) {V=1}

}}

n=2560000 4.3852734375% +/- 0.0383938876551426%
n=1280000 4.377109375% +/- 0.054248917055137104%
n=640000 4.378125% +/- 0.07672807688271979%
n=320000 4.29% +/- 0.10746183403954654%
n=160000 4.264375% +/- 0.15153993733268348%
n=80000 4.3275% +/- 0.21581969534460066%
n=40000 4.3675% +/- 0.3065602906836526%
n=20000 4.335% +/- 0.4320044330114068%
n=10000 4.44% +/- 0.6179773050808254%

If I stop here, I can conclude that the probability is 4.385% ± 0.040%

Seventh example
I have to answer 3 questions, each of which accompanied by 4 answers, of which only one is the correct one. If I answer completely randomly, what is the probability that:
A) I answer all the questions exactly;  B) I got one answer wrong;  C) I answer exactly at least two of them ?
I modify TruthValue as shown below, assuming that the OK answer is always the first (r1, r2 and r3 can be 0, 1, 2 or 3).

function TruthValue()
{ with(Math) {

r1=floor(random()*4); r2=floor(random()*4); r3=floor(random()*4)
V=0; if(r1+r2+r3==0) {V=1}

}}

n=20480000 1.5623486328125% +/- 0.008221023443472584%
n=10240000 1.561591796875% +/- 0.011623511463137245%
n=5120000 1.55830078125% +/- 0.016421072238068206%
n=2560000 1.5595703125% +/- 0.023232213332100415%
n=1280000 1.552265625% +/- 0.03277949983245769%
n=640000 1.5453125% +/- 0.0462549232686036%
n=320000 1.531875% +/- 0.06513380394598758%
n=160000 1.54625% +/- 0.09253768021932202%
n=80000 1.5075% +/- 0.1292436506018391%
n=40000 1.485% +/- 0.1814308333874995%
n=20000 1.49% +/- 0.25701022880983865%
n=10000 1.68% +/- 0.3855835933630308%

r1=floor(random()*4); r2=floor(random()*4); r3=floor(random()*4); V=0
if(r1==0 & r2==0 & r3 > 0) {V=1}
if(r1==0 & r3==0 & r2 > 0) {V=1}
if(r2==0 & r3==0 & r1 > 0) {V=1}

n=20480000 14.06828125% +/- 0.023049078094169353%
...
n=10000 13.99% +/- 1.0407017901500901%

r1=floor(random()*4); r2=floor(random()*4); r3=floor(random()*4); V=0
if(r1==0 & r2==0) {V=1}
if(r1==0 & r3==0) {V=1}
if(r2==0 & r3==0) {V=1}

n=20480000 15.614443359374999% +/- 0.024063212276052407%
...
n=10000 15.55% +/- 1.0871963712204706%
A: (1.562±0.009)%;  B: (14.07±0.03)%;  C: (15.61±0.03)%
 
The "correct" answers. A: 1/4*1/4*1/4 = 1.5625%,  B: 3/4*1/4*1/4 = 14.0625%,  C: 1.5625%+14.0625% = 15.625%