Where to start
For the practical answer, read how to create a strong password: what length and randomness do, how to build a passphrase for the few passwords you have to remember, and where to keep the rest. To know what you are defending against, read how passwords get cracked — every method, with what helps against it.
Passwords and other random values
A password is a random value that has to stay secret, and other tasks need randomness of a different shape. For a numeric code, the random number generator draws digits with the same cryptographically secure source. For an identifier in software, which has to be unique rather than secret, use the UUID generator. Neither replaces a password: for an account, use the strong password generator, which creates each password in your browser and shows its strength in bits.