Skip to content

Commit

Permalink
Bug fix: Reset random seed when needed
Browse files Browse the repository at this point in the history
Once `.spin()` is called with a `seed`, the random generator will never be reset
for subsequent calls without a `seed` argument. This patch fixes that issue.
  • Loading branch information
selcuk authored Dec 29, 2021
1 parent 77cc96b commit 2e483d9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions spintax/spintax.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def spin(string, seed=None):
random_string = ''.join(random.sample(characters, 30))

# If the user has chosen a seed for the random numbers use it
if seed is not None:
random.seed(seed)
random.seed(seed)

# Regex to find spintax seperator, defined here so it is not re-defined
# on every call to _replace_string function
Expand Down

0 comments on commit 2e483d9

Please sign in to comment.