vendredi 10 juillet 2015

c# Random class error

I have the following script:

int n = Int32.Parse(Console.ReadLine());
var r = new Random();
Console.WriteLine(r.Next(1, n));

And I got this error message:

'Random.Random' does not contain a definition for 'Next' and no extension method 'Next' accepting a first argument of type 'Random.Random' could be found (are you missing a using directive or an assembly reference?)

Where did I go wrong? Thanks for your answers!




Aucun commentaire:

Enregistrer un commentaire