I am a supporter of
St. Joseph's hospice.
 If you find this site useful or if it helped you, consider a small donation to
St. Joseph's, please.

Information on
St. Joseph's

JustGiving - Sponsor me now!



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:


If you are interested in downloading a 1,446 KB Excel 2010 sample file go to my Download page, please.

Sulprobil   Get it done   Contact   Disclaimer   Impressum   Download