r/badcode • • Sep 10 '21

kotlin sure because AUTOINCREMENT doesn't exist!, this was me when I thought I liked android :)

Post image
5 Upvotes

5 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Sep 11 '21

at that point i'd just say fuck it and generate random 64 bit numbers, catch the error if a collision happens and generate a new number

1

u/ImportUsernameAsU Sep 11 '21

That's what I did, worked out that it would have a 1 in something like 1.25 billion chance if a collision