/ Published in: JavaScript
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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 }