Newbie Syntax Question on use of System.Random.

  • Thread starter Thread starter Gomere
  • Start date Start date
G

Gomere

I am trying to use the System.Random.Next method in a class/subroutine.

I have tried using things like this:

private System.Random Rnd;

....

return ( x * Rnd.Next(1000) );

The Intellisense picks it up as legal, but the debugger says it's Null...
etc.

If someone could point me in the right direction, I would appreciate it.
 
You need to instantiate the object.

private System.Random Rnd = new System.Random();
.....
return(x * Rnd.Next(1000));

/Mikael
 
Back
Top