ncyoung.com
testing random numbers in javascript (google this)
This entry is in the following categories:
quick code snippet to make sure random numbers are coming out evenly distributed:
ct = new Array(0,0,0,0,0,0,0);
for (i=0;i<1000;i++){
j = Math.floor(Math.random() * 5);
ct[j]++;
}
for (i=0;i<ct.length;i++){
document.write(ct[i] + " of " + i + "'s<br>");
}
Dated: 09/04/2003
|
|
|