Created
December 31, 2014 08:19
-
-
Save shigemk2/a4ec5b34a0e8c8f944c7 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 math = 0; | |
var sum = 0; | |
var count = [0,0,0,0,0,0, | |
0,0,0,0,0,0,0]; | |
for(var i = 0; i < 100; i++) { | |
math = 0; | |
for(var j = 0; j < 12; j++) { | |
math += Math.floor(Math.random(0, 1) * 10) / 10; | |
} | |
sum = Math.floor(math - 6); | |
count[Math.floor(sum + 6)] += 1; | |
} | |
var star = ""; | |
for (var i = 0; i < count.length; i++) { | |
star = ""; | |
for (var j = 0; j < count[i]; j++) { | |
star += "*"; | |
} | |
console.log("%s: %s", i-6, star); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment