Dennis Sweeney <[email protected]> added the comment:
For completeness:
def random_subset_with_counts(sequence, counts):
result = []
for x, k in zip(sequence, counts):
result.extend([x] * random.getrandbits(k).bit_count())
return result
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46190>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com