aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/unique_id/__init__.py
blob: 1301a015d1c3f2efb924e22405c9a228b8b621cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import string
import random


def uniq_string_generator(size=6, chars=string.ascii_lowercase + string.digits):
    return lambda: ''.join(random.choice(chars) for _ in range(size))


gen4 = uniq_string_generator(4)
gen8 = uniq_string_generator(8)
gen16 = uniq_string_generator(16)
gen32 = uniq_string_generator(32)
gen64 = uniq_string_generator(64)