List<string> lstSample = new List<string>(); Random rand = new Random(); List<int> lstRand = new List<int>(); for (int i = 0; lstRand.Count() < sampleNum; i++) { int mRandNum = rand.Next(0, mStageDataCount); if (!lstRand.Contains(mRandNum)) { lstRand.Add(mRandNum); lstSample.Add(lstDataAll.ToList()[mRandNum]); } }