random numbers should not use the random method and instead should rely on a user-defined function like the following one:
function UnixMachine() {
if (navigator.appVersion.lastIndexOf('Unix') != -1)
return true
else
return false
}
function randomNumber() {
if (UnixMachine()) {
num = Math.random() }
else {
num = Math.abs(Math.sin(Date.getTime())); }
return num;
}
This generates a number between 0 and 1, and works well for applications needing random numbers every few seconds. If random numbers are needed with greater frequency, you need to add more variation into the equation, such as a different computation (cos, tan, log) every third division of time or something similar.
For more information, see:
Date and Math objects
random method
function and return statements