Practical guide and verification
Character set determines the search space
String length alone does not describe the number of possible outputs. The available character set and whether each position is sampled independently determine the theoretical search space.
Random-looking is not automatically secure
For passwords, tokens or API secrets, the generator needs a cryptographically secure source of randomness. A general pseudo-random generator can look random while remaining unsuitable for security credentials.
Common mistake
Do not remove “confusing” characters after generation without accounting for the smaller character set, and do not reuse one generated secret across unrelated services.