samedi 18 mars 2017

Random method in c# [duplicate]

This question already has an answer here:

I'm very beginner in c# and I don't understand why a and b have the same Output

    class Program
    {
        static int randint(int min, int max)
        {
            Random random = new Random();
            return random.Next(min, max);
        }
        static void Main(string[] args)
        {
            int a = randint(0, 100);
            Console.WriteLine(a);

            Random rand = new Random();
            int b = rand.Next(0, 100);
            Console.WriteLine(b);
        }
    }




Aucun commentaire:

Enregistrer un commentaire