Skip to content

Instantly share code, notes, and snippets.

@josephok
Last active August 29, 2015 13:57
Show Gist options
  • Save josephok/9775683 to your computer and use it in GitHub Desktop.
Save josephok/9775683 to your computer and use it in GitHub Desktop.
Generate a random string with arbitrary length
import string
import random
def random_string(length):
return ''.join(random.sample(string.printable, length))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment