In python, I am trying to create a program that generates random numbers:
from random import *
x = 10
for i in range(x):
print(randint(0, 100))
This program generates 10 random numbers between 0 and 100, like so:
81
92
86
26
78
85
28
32
79
20
But as you can see, this does not match my title. I want all these values to add up to 100. Is there anyway I can do this? Here is an example of what I would like:
11
13
42
4
5
2
3
10
5
5
(These are all randomised numbers, in this instance)
To summarise: Is there anyway to generate a set of random numbers that all sum up to one value?