Monday, March 17, 2014

Generating_Random_Value_(Wk-4), Jan 27-31, 2014

{
    class Program
    {
        static void Main(string[] args)
        {
            //Step 1: Create a Random object
            Random rand = new Random(); // the rand variable is the random object

            //Step 2: You have 3 options to generate a random object
            //(a) int n = rand.Next(); (from 0 to 2,147,483,641)
            //(b) int n = rand.Next(MaxValue); (from 0 to MaxValue-1)
            //(c) int n = rand.Next(MinValue, MaxValue); (from Min to Max)
        }
    }
}

No comments:

Post a Comment