locked
Random number RRS feed

  • Question

  • I wonder how I could use the Random class to generate a Random number in the number Range: 1 - 50 ?

    Monday, November 2, 2009 2:03 PM

Answers

  • Hi,

    Here you are:

     

    Random rand = new Random();
    var value = rand.Next(1, 50);
     
    Monday, November 2, 2009 2:08 PM
  • Found the solution:

    Random random = new Random();

    int RandomNumber = random.Next(1, 50)

    Monday, November 2, 2009 2:08 PM

All replies

  • Hi,

    Here you are:

     

    Random rand = new Random();
    var value = rand.Next(1, 50);
     
    Monday, November 2, 2009 2:08 PM
  • Found the solution:

    Random random = new Random();

    int RandomNumber = random.Next(1, 50)

    Monday, November 2, 2009 2:08 PM