Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Random Integers

//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

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);
            
            //Your code goes here
                                
            
        }
        
        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