Question: how to get a random number in ASP.Net? how to get a random number in ASP.Net

Answer: When you are going for a random number always remember that the computer does not generate truly random numbers. It simply uses an set structure to pick them. To make the number seem more random, just remember that the odds of selecting the random number at the same time is virutally impossible. Therefore for truly random numbers try this in C#\n\nRandom rand = new Random(DateTime.Now.Millisecond);\n//Millisecond is the seed value.\n//Then if you want to select from a range, enter it like this:\nint num = rand.Next(minValue, maxValue);\n\n//To select a number between 0 and a max value use this:\nint num1 = rand.Next(maxValue);\n\n//To select any random number, use this:\nint num2 = rand.Next();\n\nIf you are using VB, just make sure to use the seed and everything else is pretty much the same.\nGood Luck!
This question from the Yahoo Q&A forum is categorized in the topic: Health