dimanche 28 janvier 2018

I want a RNG to repeat itself if the number is false

I'm just testing around with C# and Random Number Generators (RNGs) and I want the RNG to repeat itself if the number isn't 1 but it won't work properly.

Random random = new Random();
label1.Text = random.Next(0, 10).ToString();           

if (label1.Text == "1")
{
    label3.Text = "Positiv";
}
else
{
    label1.Text = random.Next(0, 10).ToString();
};

Aucun commentaire:

Enregistrer un commentaire