JS机选双色球 蓝号不超过16怎么弄 求大神指教一二

 <html>
<head>
<script>
function randomTest(){
var numList = [];
for(var i=1;i<=33;i++){
   numList[i-1] = i;
}
                 for(var i=1;i<=7;i++){
            var num = Math.floor(Math.random() * (numList.length-(i-1)));
            document.getElementById('jx'+i).value=numList[num];
                    numList[num] = numList[numList.length-1-(i-1)];
                 }
 }

</script>
</head>
<body>
<input type="text" id="jx1"/>
<input type="text" id="jx2"/>
    <input type="text" id="jx3"/>
    <input type="text" id="jx4"/>
    <input type="text" id="jx5"/>
    <input type="text" id="jx6"/>
    <input type="text" id="jx7"/>
    <input type="button"value="机选一注双色球" onclick="randomTest()"/>
</body>
</html>

这个我写的 就是第七个 不知道怎么弄才不超过16 有没有什么办法 求指教

哎,
 <html>
<head>
<script>
function randomTest(){
var numList = [];
var blueNumList=[];
for(var i=1;i<=33;i++){
   numList[i-1] = i;
}
for(var i=1;i<=16;i++){
   blueNumList[i-1] = i;
}
                 for(var i=1;i<=6;i++){
            var num = Math.floor(Math.random() * (numList.length-(i-1)));
            document.getElementById('jx'+i).value=numList[num];
                    numList[num] = numList[numList.length-1-(i-1)];
                 }
var num2 = Math.floor(Math.random() * (blueNumList.length-(i-1)));
            document.getElementById('jx7').value=blueNumList[num2];
 }

</script>
</head>
<body>
<input type="text" id="jx1"/>
<input type="text" id="jx2"/>
    <input type="text" id="jx3"/>
    <input type="text" id="jx4"/>
    <input type="text" id="jx5"/>
    <input type="text" id="jx6"/>
    <input type="text" id="jx7"/>
    <input type="button"value="机选一注双色球" onclick="randomTest()"/>
</body>
</html>

大神何在 帮帮忙呀

把红球和篮球分开写啊for(var i=1;i<=7;i++){ 写成for(var i=1;i<=6;i++){ 再写一个第七个球

 <html>
<head>
    <script>
        function rnd(min, max) {
            var tmp = min;
            if (max < min) { min = max; max = tmp; }
            return Math.floor(Math.random() * (max - min + 1) + min);
        }
        function randomTest() {
            var s = ',',v;
            for (var i = 1; i <= 7; i++) {
                do { v = rnd(1, i == 7 ? 16 : 33); } while (s.indexOf(',' + v + ',') != -1)
                document.getElementById('jx' + i).value = v;
                s += v + ',';
            }
        }

    </script>
</head>
<body>
    <input type="text" id="jx1" />
    <input type="text" id="jx2" />
    <input type="text" id="jx3" />
    <input type="text" id="jx4" />
    <input type="text" id="jx5" />
    <input type="text" id="jx6" />
    <input type="text" id="jx7" />
    <input type="button" value="机选一注双色球" onclick="randomTest()" />
</body>
</html>
 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.lang.Math"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  <%
  Set set=new HashSet();
  for(int i=1;i>0;i++){
    double num=Math.random()*100;
    int a=(int)num%33+1;
    if(i==6){
        a=(int)num%16+1;
    }
    set.add(a);
    if(set.size()==7){
        break;
    }
  }
  Object arr[]=set.toArray();
  System.out.println(arr[0]);
  %>
  <script type="text/javascript">
  function randomTest(){ 

      document.getElementById("jx1").value=<%=arr[0]%>; 
      document.getElementById("jx2").value=<%=arr[1]%>; 
      document.getElementById("jx3").value=<%=arr[2]%>; 
      document.getElementById("jx4").value=<%=arr[3]%>; 
      document.getElementById("jx5").value=<%=arr[4]%>; 
      document.getElementById("jx6").value=<%=arr[5]%>; 
      document.getElementById("jx7").value=<%=arr[6]%>;
      }
  </script>


<body>
    <input type="text" id="jx1"/>

    <input type="text" id="jx2"/>

    <input type="text" id="jx3"/>

    <input type="text" id="jx4"/>

    <input type="text" id="jx5"/>

    <input type="text" id="jx6"/>

    <input type="text" id="jx7"/>

    <input type="button" value="机选一注双色球" onclick="randomTest()"/>

  </body>
</html>

写7个随机数,第七个随机1到16的