Created
March 4, 2014 21:28
-
-
Save ViktorStiskala/9356097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_sum_into_parts(limit=1500, min_parts=2, max_parts=5): | |
sample = sorted([0, limit] + random.sample(range(limit), random.randint(min_parts-1, max_parts-1))) | |
return [sample[i+1] - item for i, item in enumerate(sample) if i+1 < len(sample)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment