dimanche 17 juin 2018

Always getting the same numbers generated

i made a method to generate a number. But i'm always getting the same number in dice1 as in dice2. Why is this and how can i fix this?

        int dice1 = GenerateNumber();
        int dice2 = GenerateNumber();

        Console.WriteLine(dice1);
        Console.WriteLine(dice2);            


        static int GenerateNumber()
    {
        Random random = new Random();
        int dice = random.Next(1, 7);
        return dice;
    }




Aucun commentaire:

Enregistrer un commentaire