mercredi 4 juillet 2018

Generate random list of given length with given sum - python [duplicate]

This question already has an answer here:

I would like to know a way how to generate random list of given length with elements that would sum up to given integer. For example: generate 7 random numbers with sum of 100. There shouldn't be zeroes in this list and it should be integers. Preferably in python or pseudo code.




Aucun commentaire:

Enregistrer un commentaire