CSharp examples for Language Basics:Random
Shifted and scaled random integers.
using System;//from ww w .ja v a2s.c om class MainClass { static void Main() { Random randomNumbers = new Random(); // random-number generator for (int counter = 1; counter <= 20; ++counter) { // pick random integer from 1 to 6 int face = randomNumbers.Next(1, 7); Console.Write($"{face} "); // display generated value } } }