-
-
Save anonymous/4c455531fa13ab526532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var c = 0; | |
for (var j = 0; j < 10000000;) | |
{ | |
// assume heal, dark, green, light in sequence | |
var array = [0,0,0,0]; | |
for (var i=0; i<30; i++) | |
{ | |
var ball = Math.floor(Math.random() * 4); | |
array[ball]++; | |
} | |
// skip if any ball is less than 3 | |
if (array[0] >= 3 && array[1] >= 3 && array[2] >= 3 && array[3] >= 3) | |
{ | |
j++; | |
// if heal is less than 6 | |
if (array[0] < 6) | |
{ | |
c++; | |
} | |
} | |
} | |
document.write(c / 10000000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment