Hey Bill,<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">

<div>If we have 100 apples, for example, and we need to distrubte the 100 apples randomly in 10 boxes, how can we do this in python?</div></div></div></blockquote><div><br>I assume the only invariant is sum(box_apples_i) == 100 for 10 boxes?<br>
<br>Maybe the following would do?<br><br>from random import sample<br>partitions = [0] + sorted(sample(range(100), 9)) + [100]<br>print [b-a for a, b in zip(partitions, partitions[1:])]<br><br>best,<br>Tom<br><br>PS I&#39;m not sure if this is the best mailing list for such a problem? Maybe someone who knows could chip in. <br>
<br></div></div>