If the probability of success is difficult to compute, we can find an approximation by performing many of the experiments and observe the outcome.
The probability of success can be approximated by the quotion of:
# times that the outcome is succesfull  # times that the experiment are performed
This is done by generating random events that corresponds to the experiments and evaluate their outcome
We will looks at a simple experiment to find Pi

Area of the quarter circle  Area of the 1 x 1 square
Area of the quarter circle  = Pi/4 Area of the 1 x 1 square
int i; int nThrows = 0; int nSuccess = 0; for (i = 0; i < aLargeNumber; i++) { "Throw a dart"; nThrows++; if ( "dart lands inside quarter circle" ) nSuccess++; } System.out.println("Pi/4 = " + (double)nSuccess/nThrows ); 
Generate 2 random numbers:
that represent the coordinates of the position that a dart lands when thrown blindfolded (i.e., at random) 
x * x + y * y <= 1.0 
int i; int nThrows = 0; int nSuccess = 0; Random genX = new Random(); Random genY = new Random(); double x, y; for (i = 0; i < aLargeNumber; i++) { x = genX.nextDouble(); // y = genY.nextDouble(); // "Throw a dart"; nThrows++; if ( x*x + y*y <= 1 ) nSuccess++; } System.out.println("Pi/4 = " + (double)nSuccess/nThrows ); 