Skip to content

Instantly share code, notes, and snippets.

Created May 7, 2020
What would you like to do?
from random import shuffle
from typing import Sequence, List, Any
def sample(population: Sequence, size: int) -> List:
if size < 1:
raise ValueError('size must be >= 1')
result = list(population)
return result[:size]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment