Skip to content

Instantly share code, notes, and snippets.

One-line Random String Generator

Python

CSPRNG (Cryptographically Secure Pseudo-Random Number Generator) functions:

  • os.urandom(n): return a string of n random bytes.
  • random.SystemRandom(): provides random functions that uses os.urandom().

Note: Don't use random module for PRNG for security purposes.

Keybase proof

I hereby claim:

  • I am marioapardo on github.
  • I am darkadan (https://keybase.io/darkadan) on keybase.
  • I have a public key whose fingerprint is 997E 80D7 851E C06F 0828 7675 367A B299 03F6 320B

To claim this, I am signing this object: