mardi 15 décembre 2020

What does secrets module do to make perfect random sequences in Python

Now I have a decent knowledge of math, and I know it's possible to create pseudo-random sequences using a specific mathematics algorithm. I also know that in Python, there is a secrets module that apparently can produce random numbers. I tried tweaking around with it a little, but I still don't understand how it's supposed to work. Lets say this piece of code:

import secrets

secret_num = secrets.choice([1, 2, 3])
print(secret_num)

It's supposed to output a perfectly random number. But how is that possible using computers?




Aucun commentaire:

Enregistrer un commentaire