jloga4
7/2/2017 - 9:17 PM

Example of how to print a sequence of random numbers using the .Next() method from the Random class. From Fundamentals of Computer Programmi

Example of how to print a sequence of random numbers using the .Next() method from the Random class. From Fundamentals of Computer Programming with C# http://www.introprogramming.info/wp-content/uploads/2013/07/Books/CSharpEn/Fundamentals-of-Computer-Programming-with-CSharp-Nakov-eBook-v2013.pdf

Random rand = new Random();

for (int number = 1; number <= 6; number++)
{
  int randomNumber = rand.Next(49) + 1;
  Console.Write("{0} ", randomNumber);
}

//  6 41 33 27 4 14