I want to generate three random variables a, b and c such that (i) a+b+c=0; and (ii) each one is uniformly distributed in (-1,1).
The two-variable version is easy: a=2*rand()-1; b=-a. (Note: rand() is uniformly distributed in (0,1))
The following solution doesn't work because c's range is too large: a=2*rand()-1; b=2*rand()-1; c=-a-b.
The following solution doesn't work either because c is not uniformly distributed: a=2*rand()-1; b=2*rand()-1; c=(-a-b)/2.