Random.Next(range) : Random « System « C# / C Sharp by API






Random.Next(range)

  

using System;

public class RandomIntegers
{
   public static void Main( string[] args )
   {
      Random randomNumbers = new Random(); 
      int face; 

      for ( int counter = 1; counter <= 20; counter++ )
      {
         face = randomNumbers.Next( 1, 7 );
         Console.Write( "{0}  ", face );
         if ( counter % 5 == 0 )
            Console.WriteLine();
      } 
   }
} 

   
    
  








Related examples in the same category

1.Random.Next()
2.Random.NextDouble()