I want to create a random unique numbers therefore I wrote 2 codes but i'm wondering if those codes will match my needs .
CODE 1:
Random rand = new Random((Guid.NewGuid().GetHashCode()));
int numIterations = 0;
numIterations = rand.Next(100000, 999999);
return numIterations.ToString();
CODE 2:
Random rand = new Random((int)DateTime.Now.Ticks);
int numIterations = 0;
numIterations = rand.Next(100000, 999999);
return numIterations.ToString();
please help me .
Aucun commentaire:
Enregistrer un commentaire