Commit 0e2e735d authored by Tim McNamara's avatar Tim McNamara


parent 4658a568
Occasionally, we want to generate random strings within our code.
import (
func RandString(length int) string {
// omitting vowels so that we don't generate swear words
alphabet := []rune("-abcdfghjklmnpqrstvwxyz0123456789")
out := make([]rune, length)
for i := out {
out[i] = alphabet[rand.Intn(len(letters)]
return string(out)
import random
ALPHABET = "-abcdfghjklmnpqrstvwxyz0123456789"
def random_string(length, alphabet=ALPHABET):
return ''.join(random.choice(alphabet) for _ in range(length))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment