摘要:
1<script>2document.write(parseInt(10*Math.random())); //输出0~10之间的随机整数34document.write(Math.floor(Math.random()*10+1)); //输出1~10之间的随机整数56functionRndNum(n){7varrnd="";8for(vari=0;i<n;i++)9rnd+=Math.floor(Math.random()*10);10returnrnd;11}12document.write(RndNum(4)); //输出指定位数的随机数的随机整数 阅读全文