Let's say I have a number m (it will be integer, usually 1) and I want to split m into n random numbers, which have the sum m. I want to make a distribution which will be random, but will be close (doesn't have to be really close) to uniform distribution.
I have this
pieces = []
for i in range(n-1):
pieces.append(random.uniform(0,m-sum(pieces)))
pieces.append(m-sum(pieces))
The problem is, that the first number is usually really high compared to the rest of the numbers. When I tried it for m = 1 and let's say n=10, the first number was close to 0,5 and the last number was close to like 0,001 (or something like that), which is not a problem, but the problem is, that the first number is on average really big compared to all of the other numbers.
My question is: Is there some kind of way to do this, so the numbers are closer? There can be a big difference between biggest and smallest number, but I want it to feel more uniform, if that makes sense.