samedi 21 janvier 2017

Generate an unique and random integer

I want to make user accounts with a public_id being always random (not incremental) and also an unique integer value. I can use loops to check if random int is unique, but that doesn't seem like a really nice solution. P.S. Searched on google, but found only alphabetic-numeric generators, and I am guessing I can convert them to ints using some string to int converter, but is were a integer specific ways? I am also worrying about possible collisions, but it looks like the chance will be always there in a long run.(?)




Aucun commentaire:

Enregistrer un commentaire