algorithm - Choosing n numbers with fixed sum -
in code want choose n random numbers in [0,1) sum 1.
i choosing numbers independently in [0,1) , normalizing them dividing each 1 total sum:
numbers = [random() in range(n)] numbers = [n/sum(numbers) n in numbers] my "problem" is, distribution out quite skew. choosing million numbers not single 1 gets on 1/2. effort i've calculated pdf, , it's not nice.
here weird looking pdf 5 variables:

do have idea nice algorithm choose numbers, result in more uniform or simple distribution?
you looking partition distance 0 1.
choose n - 1 numbers 0 1, sort them , determine distances between each of them.
this partition space 0 1, should yield occasional large result aren't getting.
even so, large values of n, can expect max value decrease well, not method.
Comments
Post a Comment