I am attempting to create a new character which has a randomly generated level. This character has 8 attributes, I need to randomly generate those 8 attributes so that their sum is equal to the generated level, plus 8. So far I have this..
level = random.randint(1, 30) * 5
base = int(0.1 * level)
stats = []
*****
health = int(atts[0])
strength = int(atts[1])
agility = int(atts[2])
willpower = int(atts[3])
charisma = int(atts[4])
intelligence = int(atts[5])
speed = int(atts[6])
luck = int(atts[7])
I am looking to replace the asterisks with the code which would generate the 8 random integers that add up to the level + 8, and append them to "atts." Based on other answers I have seen to similar questions, I tried the following which gets me the 8 integers I need, but I'm struggling with figuring out how to make them add up to the level.
for i in range(0, 8):
arr = random.randint(base, level)
atts.append(arr)