I asked this question a week ago but it ended up being closed for not being specific enough. I am going to try and define everything as mathematically as possible in this one, so please let me know if there is anything ambiguous.
How can I randomly distribute W litres of water into n empty buckets without them overflowing (i.e. without putting more water into the bucket then it can hold)
There are $n$ buckets of water with the $i^{th}$ bucket containing $w_i$ litres of water.
1) $W = w_1 + w_2 + ... + w_n =$ Total amount of water
2) $w_i$ $\epsilon$ $[0, x]$ for $i = 1, 2, ..., n$ where $x$ $\epsilon$ $\Re$
Given a natural number $n$ and real number value for $x$ and $W$, what process can I use to assign a random value to each $w_i$, such that (1) and (2) remain true?
To clarify what I mean by random, I am thinking of a function which returns a value in the interval $[0, 1]$ similar to the .NextDouble() method in the Random class (And yes, I know this is pseudo-random and not truly random).
Example:
For $n$ = 3, $W$ = 1 and $x$ = 1 one possible solution is:
$w_1$ = 0.22 $w_2$ = 0.43 $w_3$ = 0.35
Since $w_1 + w_2 + w_3 = 0.22 + 0.43 + 0.35 = 1 = W$ and $w_1$, $w_2$ and $w_3$ are in the interval $[0,1]$