// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; public class Rng { public const int N = 10; public const int K = 100; public static void Main(string[] args) { // initialize random generator Random rng = new Random(); for(int i = 0; i < N; i++) { // generate random integer in the range from 0 (inclusive) to K-1 (inclusive) int rani = rng.Next(K); Console.WriteLine(rani); } for(int i = 0; i < N; i++) { // generate random double in the range 0.0 (inclusive) to 1.0 (exclusive) double ranx = rng.NextDouble(); Console.WriteLine(ranx); } } }