I want to generate 10 digit unique-id in python. I have tried below methods but no-one worked
- get_random_string(10) -> It generate random string which has probability of collision
- str(uuid.uuid4())[:10] -> Since I am taking a prefix only, it also has probability of collision
- sequential -> I can generate unique sequential ID by prepending 0s but it will be sequential and easier to guess. So I want to avoid sequential ids
Do we have any proper system to generate 10 digit unique-id?
Try to use hashlib module so: