Let's say we have a cake of size N that should be distributed among K people. I wonder what is the most pythonic way to divide the cake in K random pieces. To put this example into more detail, when having a amount 10 of cake to distribute among 3 people, the one time the distribution could be [1, 4, 5], the other time [3, 3, 4], etc.
Aucun commentaire:
Enregistrer un commentaire