Hi Muhammed,
On 20/01/2020 11.25, Muhammed Rafi A wrote:
|importuuid uuid.uuid4().hex[:8]
|
|or
|fromdjango.utils.crypto importget_random_string
get_random_string(8).lower()
||
def get_random_string(length=12,
allowed_chars='abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
There's nothing wrong with this as far as I can tell, but I'm fairly
certain this is more or less guaranteed to generate duplicates if
generating 10.000.000.000 values.
Of course, it would be nice to know what OPs use case is. Doesn't sound
like this is the right solution for whatever the problem is he's trying
to solve.
Kind regards,
Kasper Laudrup
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9f2f08d6-1bd2-83a2-950e-4897f3b16376%40stacktrace.dk.