14
Generate two random numbers between 0 and 1. Divide those each by 3. The third is the difference of 1 and the two random thirds:
void Main()
{
Random r = new Random();
double d1 = r.NextDouble() / 3.0;
double d2 = r.NextDouble() / 3.0;
double d3 = 1.0 - d1 - d2;
System.Console.WriteLine(d1);
System.Console.WriteLine(d2);
System.Console.WriteLine(d3);
System.Console.WriteLine(d1 + d2 + d3);
}
this outputs the following in LINQPad:
0.0514050276878934
0.156857372489847
0.79173759982226
1