mercredi 3 février 2021

How to get a random and non-repetitive number in C# [duplicate]

I want to get a random and non-repetitive number between 2 intervals. What I mean by non-repetitive:

Random random = new Random();
while(//something)
{
  int myRandomNumber = random.Next(0,4);
  //do something with random
}

For example myRandomNumber is now 3, how can I have my next random number to be between (0,4) but not 3?




Aucun commentaire:

Enregistrer un commentaire