利用javascript来生成随机数。
<script language="JavaScript">
<!--
// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See: http://www.msc.cornell.edu/~houle/javascript/randomizer.html
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
alert(rand(100)); //这里的100表示要产生0~100之间的数
// end central randomizer. -->
</script>
时间: 2024-11-10 08:21:34