Created
August 8, 2019 17:46
-
-
Save vlad-bezden/e055c28f936f35c5e84154df62255dad to your computer and use it in GitHub Desktop.
Generator that generates infinite stream of random numbers between 1 and 99 inclusive.
This file contains hidden or 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
gen = (random.randrange(1, 100, 2) for _ in itertools.count()) | |
# or | |
gen = (random.randrange(1, 100, 2) for _ in itertools.cycle("Happy Coding!")) | |
# usage: | |
for n in gen: | |
print(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment