private void get5check(int[] list, int blue, ref int count, ref int itotal) { piao[] pp = new piao[5]; Random rp = new Random(Guid.NewGuid().GetHashCode()); for (int i = 0; i < pp.Length; i++) { pp[i].red = new List <int>(); while (pp[i].red.Count < 6) { rp = new Random(Guid.NewGuid().GetHashCode()); int itep = rp.Next(1, 34); bool bexsist = false; for (int ii = 0; ii < pp[i].red.Count; ii++) { if (pp[i].red[ii] == itep) { bexsist = true; break; } } if (!bexsist) { pp[i].red.Add(itep); } } rp = new Random(Guid.NewGuid().GetHashCode()); pp[i].blue = rp.Next(1, 17); pp[i].red.Sort(); if (pp[i].red[0] == list[0] && pp[i].red[1] == list[1] && pp[i].red[2] == list[2] && pp[i].red[3] == list[3] && pp[i].red[4] == list[4] && pp[i].red[5] == list[5] && pp[i].blue == blue) { m_mutex.WaitOne(); count++; m_mutex.ReleaseMutex(); } m_mutex.WaitOne(); itotal++; m_mutex.ReleaseMutex(); } }
private void get5() { piao[] pp = new piao[5]; Random rp = new Random(Guid.NewGuid().GetHashCode()); for (int i = 0; i < pp.Length; i++) { pp[i].red = new List <int>(); while (pp[i].red.Count < 6) { rp = new Random(Guid.NewGuid().GetHashCode()); int itep = rp.Next(1, 34); bool bexsist = false; for (int ii = 0; ii < pp[i].red.Count; ii++) { if (pp[i].red[ii] == itep) { bexsist = true; break; } } if (!bexsist) { pp[i].red.Add(itep); } } rp = new Random(Guid.NewGuid().GetHashCode()); pp[i].blue = rp.Next(1, 17); } for (int i = 0; i < pp.Length; i++) { pp[i].red.Sort(); for (int ii = 0; ii < pp[i].red.Count; ii++) { richTextBox1.AppendText(pp[i].red[ii].ToString("00") + " "); } richTextBox1.AppendText(" | " + pp[i].blue.ToString("00") + " "); richTextBox1.AppendText("\n"); } }