Get A Random Number From A Seed In Python

September 2024

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