Now we present an example of random number generation with a side condition. The sum of all created random numbers should be 1. This can be achieved by many different approaches.
Three possible approaches are: 1. Reduce grade of freedom successively: create first random number, then the second one in range[0,1-first], the third one in [0,1-first-second], ..., the last will be 1-sum of all others 2. Create n random numbers and divide them by their sum 3. Simulate slicing a cake: whereever you cut, you cannot distribute more than one cake
The resulting distributions look like - graphic was created with 10,000 runs for n=3:
|