Further Reading Most random number generator (RNG) algorithms are pseudorandom: they appear random but are
actually predictable. Pseudorandom algorithms have an initial value (often an integer) called a seed,
and the same starting seed value produces the same random numbers. For example, you can reset
Python’s seed by passing a seed integer to random.seed(). Notice how setting the same seed in the
following interactive shell example produces the same sequence of ―random‖ numbers:
>>> import random
>>> random.seed(42)
# Use any arbitrary integer for the seed. >>> for i in range(20):
... print(random.randint(0, 9), end=' ')
...
1 0 4 3 3 2 1 8 1 9 6 0 0 1 3 3 8 9 0 8
>>> random.seed(42)
# Reset using the same integer seed. >>> for i in range(20):
... print(random.randint(0, 9), end=' ')
...
1 0 4 3 3 2 1 8 1 9 6 0 0 1 3 3 8 9 0 8
Python can also generate truly random, not pseudorandom, numbers based on several sources of
systems entropy such as boot time, process IDs, position of the mouse cursor, millisecond timing in
between the last several keystrokes, and others. You can look up the official Python documentation
for the random.SystemRandom() function at https://docs.python.org/3/library/random.html.
These theoretical hacks on pseudorandom numbers might concern you if you’re an international
spy or a journalist targeted by the intelligence agencies of nation-states, but in general, using this
program is fine. Randomly- and pseudorandomly-generated passwords are still better than using a
predictable password like ―Stanley123‖. And many hacks happen because people have keystroke-
reading malware on their computers or reuse the same password for multiple accounts. So if the
password database of a website you use is hacked, those hackers can then try to identify the users’
accounts on other popular websites and try those same passwords.
A password manager app is the most effective single thing a computer user can have to increase
their security. When you need to log into a website, you enter your master password into the
password manager app to unlock its encrypted database. Then you can copy the password from the
manager to the clipboard. For example, your password could be something like
GKfazu8WposcVP!EL8, but logging in with it is just a matter of pressing Ctrl-V to paste it into the
website’s login page.
I recommend the free and open-source KeePass app from https://keepass.info, but many password
manager apps are freely available.