home ~ projects ~ socials

Get A Random Number From A Seed In Python

You can use a sed to always get the same result from a call to a random function like this:

import random

random.seed(123)

print(random.randint(0, 1123))
Output:
107

It's useful for testing

-- end of line --