求任意2个范围之内的随机整数
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>求任意2个范围之内的随机整数</title>
</head>
<body>
<script type="text/javascript">
function select(start,end){
var total=end-start+1;
return Math.floor(Math.random()*total+start);
}
for(var i=0;i<10;i++){
document.write(select(1,10));
document.write('<br/>');
}
</script>
</body>
</html>
学会忘记是生活的技术,学会微笑是生活的艺术