Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Method Name expected error. So I know that the issue is with the \"rand\" at the

ID: 3768510 • Letter: M

Question

Method Name expected error.

So I know that the issue is with the "rand" at the beginning, I just don't know how to fix it...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Random_Number_Generator
{
class rand
{
static void Main(string[] args)
{
Random rand = new Random();
int n;

n = 1 + rand() % 2;
Console.WriteLine("{0}", n);

n = 1 + rand() % 100;
Console.WriteLine("{0}", n);

n = rand() % 10;
Console.WriteLine("{0}", n);

n = 1000 + rand() % 113;   
Console.WriteLine("{0}", n);

n = -1 + rand() % 3;
Console.WriteLine("{0}", n);

n = -3 + rand() % 15;   
Console.WriteLine("{0}", n);
}
}
}

Explanation / Answer

use

instead of rand().