Skip to content

Instantly share code, notes, and snippets.

@ELC
Created December 17, 2017 22:09
Show Gist options
  • Save ELC/d2e86a653cbe11ce3e424f0d29cd014c to your computer and use it in GitHub Desktop.
Save ELC/d2e86a653cbe11ce3e424f0d29cd014c to your computer and use it in GitHub Desktop.
def generate_random(seed):
digits = len(str(seed))
while True:
candidate_number = str(seed**2)
candidate_number_filled = '0' * (2 * digits - len(candidate_number)) + candidate_number
seed = int(candidate_number_filled[digits//2:-digits//2])
yield seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment