google app engine - Generating short, random and unique string on Appengine -
i want generate string ids have next properties:
short, 5-6 apha + numbers random unique, desired, not of import first toocurrently thinking about:
allocate unique id https://developers.google.com/appengine/docs/python/datastore/functions#allocate_ids hash secret key, md5(id + secret) take first 5 symbolsis there improve way? thought using datacenter_id + instance_id + request_id , have no thought if better.
why not generate random string using random.choise?
for _ in xrange(5): yield random.choice(digits + alpha)
this has space of 36^5 keys
google-app-engine random
No comments:
Post a Comment