protected void btnGetBingoNum_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();
        DataSet ds = bll_cou.GetAllCoupon();
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                list.Add(ds.Tables[0].Rows[i]["Code"].ToString());
            }
           //list  是一堆 已经生成的 随机码
            if (txtCoupon1.Text != "")  //txtCoupon1.Text   为在那堆随机码里生成多少个有效的
            {
                int count = int.Parse(txtCoupon1.Text.Trim());
                if (count < list.Count)
                {
                    for (int i = 0; i < count; i++)
                    {
                        Random rand = new Random();
                        int index = rand.Next(0,list.Count);
                        ProcessGetBingo(list, index, ds);
                        list.Remove(list[index]);
                    }
                }
            }
        }
        BindGv();
        txtCoupon1.Text = "";
    } protected void ProcessGetBingo(ArrayList list,int index,DataSet ds)
    {
        if (IsExistCode(list[index].ToString()))
        {
            DataSet ds_c = bll_cou.GetCouponByCode(list[index].ToString());
            if (ds_c != null && ds_c.Tables.Count > 0 && ds_c.Tables[0].Rows.Count > 0)
            {
                if (ds_c.Tables[0].Rows[0]["IsBingo"].ToString() == "0")
                {
                    UpdateBingoNum(ds_c); //更新
                }
                else
                {
                    index = new Random().Next(0,list.Count);
                    ProcessGetBingo(list, index, ds);
                }
            }
        }
    }总感觉生成后的随机码出现的位置会挤在一起,就是分布位置不太均匀