Math.random();
Generate a number between 1 and 100:
var seed = Math.random(); var n = seed * 100 + 1; n = Math.floor(n); alert(n);
Generate a number between 10 and 100:
var seed = Math.random(); var n = seed * 90 + 10; n = Math.floor(n); alert(n);
Generate a number between 23 and 42:
var seed = Math.random(); var n = seed * (42-23) + 23; n = Math.floor(n); alert(n);