How to generate a random number
-
How to generate a random number. I have Visual Studio 2003. Help.
Vasildb
-
How to generate a random number. I have Visual Studio 2003. Help.
Vasildb
use the following code snippet: Random rand=new Random(); and then u can use rand.Next(1,100); to generate a random no. between 1 & 100 Basically u have to specify the limits in which u want to generate a random no. Hope this will work.:)
NEHA GUPTA
-
use the following code snippet: Random rand=new Random(); and then u can use rand.Next(1,100); to generate a random no. between 1 & 100 Basically u have to specify the limits in which u want to generate a random no. Hope this will work.:)
NEHA GUPTA
-
Neha_Gupta wrote:
and then u can use rand.Next(1,100); to generate a random no. between 1 & 100
That will generate a random number between 1 and 99.
--- b { font-weight: normal; }
Thanx Guffa for correcting me :)
NEHA GUPTA
-
Neha_Gupta wrote:
and then u can use rand.Next(1,100); to generate a random no. between 1 & 100
That will generate a random number between 1 and 99.
--- b { font-weight: normal; }
Thanks Guffa. This information helped me too. I was using the random generation in my program and was thinking the probability of generating last number could be less... but now came to know it does not generate. Intead it generates till one less(as in your example betwen 1-99) Thanks again!!!
- ashish