StringBuilder MyCi = new StringBuilder();
            for (int x = 0; x < 300; x++)
            {
                Random Rand = new Random();
                MyCi.Append(Rand.Next(0,1000 + " ");
            }            MessageBox.Show(MyCi.ToString());
怎么随机出来的数有80%是重复。

解决方案 »

  1.   

    StringBuilder MyCi = new StringBuilder();
    Random Rand = new Random();
    for (int x = 0; x < 300; x++)
    {
        MyCi.Append(Rand.Next(0,1000).ToString() + " ");
    }MessageBox.Show(MyCi.ToString());
      

  2.   

     StringBuilder MyCi = new StringBuilder();
                for (int x = 0; x < 300; x++)
                {
                    Random Rand = new Random(x);
                    MyCi.Append(Rand.Next(0,1000 + " ");
                }            MessageBox.Show(MyCi.ToString());
    搞定了,还是把分给你。