Download augmentoolkit/utils/sample_and_remove.py from Leon4gr45/agent-0: direct link, hf CLI and curl.
- Browser
- Download file 203 Bytes
-
https://huggingface.co/spaces/Leon4gr45/agent-0/resolve/main/augmentoolkit/utils/sample_and_remove.py
- Command line
-
hf download hf://spaces/Leon4gr45/agent-0/augmentoolkit/utils/sample_and_remove.py
-
curl -L -o sample_and_remove.py https://huggingface.co/spaces/Leon4gr45/agent-0/resolve/main/augmentoolkit/utils/sample_and_remove.py
203 Bytes
| import random | |
| def sample_and_remove(lst, n): | |
| sampled = [] | |
| for _ in range(min(n, len(lst))): | |
| index = random.randrange(len(lst)) | |
| sampled.append(lst.pop(index)) | |
| return sampled | |