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