Return to Snippet

Revision: 59004
at August 13, 2012 16:59 by Zielak


Initial Code
function rnd(j){
arr = [0,0]
for(i=0;i<=j;i++){
r = Math.round(Math.random())
arr[r] = arr[r]+1
}
a = arr[0] / arr[1] * 100
return a
}

Initial URL

                                

Initial Description
This function tests how random will the Math.random() function be. You can test it with rnd(1000000) a couple of times to get results.

Initial Title
Test randomness in JavaScript

Initial Tags

                                

Initial Language
JavaScript