I’m using C# in .NET Framework 3.5 and am trying to generate a random integer by using Random(). My code is here:
using System.Random;
int randomNumber;
Random RNG = new Random();
randomNumber = RNG.Next(1,10);
I think everything should be alright, but I’m getting the error that System.Random isn’t a valid namespace, but I’m pretty sure it is…
Anybody know what’s the problem or some other method I should be using to generate a random integer within a range?
Randomis a class in theSystemnamespace. Change the first line to justusing System;and you should be good to go.