随机排1-100数字
<html>
<head>
<title>JavaScript Shuffle Arithmetic</title>
<meta name="author" content="" />
</head>
<body>
<script language="javascript">
var sequence = new Array(100);
for ( var i=0 ; i < 100 ; i++ )
{
aa[i] = i+1;
}
alert(aa(sequence));
function aa(ary)
{
for ( var i=ary.length-1 ; i >= 0 ; i-- )
{
var v = parseInt(Math.random()*(i+1));
var tmp = ary[v];
ary[v] = ary[i];
ary[i] = tmp;
}
return ary;
}
</script>
</body>
</html>
<head>
<title>JavaScript Shuffle Arithmetic</title>
<meta name="author" content="" />
</head>
<body>
<script language="javascript">
var sequence = new Array(100);
for ( var i=0 ; i < 100 ; i++ )
{
aa[i] = i+1;
}
alert(aa(sequence));
function aa(ary)
{
for ( var i=ary.length-1 ; i >= 0 ; i-- )
{
var v = parseInt(Math.random()*(i+1));
var tmp = ary[v];
ary[v] = ary[i];
ary[i] = tmp;
}
return ary;
}
</script>
</body>
</html>