I have a number generator that can generate numbers between 0 and 1. I want to somehow use this generate a set of $N$ numbers that add up to $1$, and include negative numbers. These numbers must be uniformly distributed.
For example, if $N = 3$, one possible result might be $(0.4, -0.5, 1.1)$. Another might be $(0.2, 0.4, 0.4)$.
Is this possible? And if so, how would I go about it?
EDIT: I would rather the numbers are limited to be between $-1$ and $1$. So $(0.4, -0.5, 1.1)$ is no longer a possible combination.
An $n$-tuple $(x_{1}, \cdots, x_{n})$ of independently, uniformly distributed numbers can be thought as a uniformly chosen point in an $n$-dimensional box (with probability measure chosen as the normalized Lebesgue measure on this box).
In this case, note that the region
$$D = \{ (x_{1}, \cdots, x_{n} ) \in \Bbb{R}^{n} : -1 \leq x_{j} \leq 1 \text{ and } x_{1} + \cdots + x_{n} = 1 \}$$
defines an $(n-1)$-dimensional flat surface. So it makes sense to choose the uniform distribution for this problem as the normalized surface measure on $D$.
Though we may devise a clever formula for generating such uniform samples on $D$, I will adopt a crude method.
Let $\Bbb{A}$ be the hyperplane containing $D$ and let $\pi : \Bbb{R}^{n} \to \Bbb{A}$ be the orthogonal projection onto $\Bbb{A}$. Choose a box $B$ in $\Bbb{R}^{n-1} \simeq \Bbb{R}^{n-1}\times\{0\}$ so that $D \subset \pi(B)$. If $U$ denotes the uniform distribution on $B$, then our desired uniform distribution for $D$ is given by
$$ \Bbb{E}[\pi U \vert \pi^{-1}D]. $$
Implementing this random variable is very simple:
It is easy to check that
$$ \pi(x_{1}, \cdots, x_{n}) = \left(x_{1} - \bar{x}+\frac{1}{n}, \cdots, x_{n} - \bar{x}+\frac{1}{n} \right), \qquad \bar{x} = \frac{x_{1} + \cdots + x_{n}}{n}. $$
Also it turns out that $B$ can be taken as $[-1-\sqrt{n}, 1+\sqrt{n}]^{n-1}$. The following is a simulation for $n = 3$ with $10000$ samples.