Number one is easy, that's what's returned from the NextDouble
method;
Random rnd = new Random();
double number = rnd.NextDouble();
To exclude the zero, pick a new number if you get a zero:
double number;
do {
number = rnd.NextDouble();
} while(number == 0.0);
To include 1 but not 0, subtract the random number from 1:
double number = 1.0 - rnd.NextDouble();
To include both 0 and 1, you would use an approach similar to what King King suggests, with a sufficiently large number for your need:
double number = (double)rnd.Next(Int32.MaxValue) / (Int32.MaxValue - 1);
(Using ints you can get 31 bits of precision. If you need more than that you would need to use NextBytes
to get 8 bytes that you can turn into a long.)