Random Integers
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static List<int> Integers {get;set;}
public static void Main(string[] args)
{
Initialize(100, 0, 100);
}
public static void Initialize(int numberOfItems, int min, int max) {
Integers = new List<int>();
var rnd = new Random();
for(var i=0; i < numberOfItems; i++) {
var newNum = rnd.Next(min, max);
Integers.Add(newNum);
}
}
public static void PrintIt(List<int> ints) {
for(var i=0; i < ints.Count(); i++) {
var n = ints[i];
Console.Write(n);
if (i < ints.Count() - 1) {
Console.Write(", ");
}
}
Console.WriteLine("");
Console.WriteLine("Done!");
}
}
}
|
run
| edit
| history
| help
|
0
|
|
|