Created
December 28, 2020 15:01
-
-
Save wilfreddesert/99d839192228f6a7b2eaf2ec66aa472a 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
import pytest | |
import random | |
@pytest.fixture | |
def make_rnd_gen(): | |
def _get_result(seed, mode): | |
# Hint: use pytest.fixture | |
if mode == 0: | |
return random.Random(seed).randint(-1000, 1000) | |
elif mode == 1: | |
return random.Random(seed ** 2).randint(-1000, 1000) | |
elif mode == 2: | |
return random.Random(seed).randint(1, 50) | |
elif mode == 3: | |
return random.Random(seed ** 2).gauss(0, 5) | |
else: | |
return random.Random(seed).choice(range(10000)) | |
return _get_result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment