I want to create a random number with a text in front of it, and I don't want the system displaying a number twice. So, this is that the way that I did it:
Random _rand = new Random();
private void RandomNumberGenerator()
{
int random = _rand.Next(10000);
string text = "TP0" + random;
if (random.Equals(random))
{
_rand.Next();
}
else
{
random = _rand.Next(10000);
}
MessageBox.Show(text);
}
I am not getting any displayed number twice (but I am not too sure, because I just close the program until it displayed the number 5 times (all of it are not the same number).
Is it possible from the above code to displaying a number twice with any chance?
Thank you.