Random value between 0 and 1

yes4me used Ask the Experts™
Java and Javascript have random commands that only return values between 0 and 1 (I guess double). Does C# have such feature or does it has only the following commands?

System.Random randint = new System.Random();
int i = (int)(randint.Next(1,2));

System.Random randchar = new System.Random();
char c = (char)(randchar.Next('a','z'));
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I guess these are your only options in C#

C# does have that build into the Random class. Try this:

System.Random rnd = new System.Random();
double d = rnd.NextDouble();

Hope it helps.

Jack Conroy

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial