cesarz
❔ Unique Integer ID GEN from string input
Hi there, I've been trying to think of a unique integer ID generator but let's just say I'm not too good at this
The one I made is quite simple and it just shifts all the characters by 67 (so that all int values of the characters (33 to 126) are in range of 100 to 193) and adds the numbers together (side by side, so 102 '+' 192 => 102192)
It works and the ID's are unique but the issue is quite obvious -> the ID's are way too long.
I could ignore the last 4 characters in my initial range (which are
{ | } ~
) and I would be able to squeeze my range into 10 to 99, but still: for ulong that would mean a character length limit of 9... which is quite low.
I searched online for some unique integer ID generating algorithms but couldn't find anything useful for my case, or I'm just blind and didn't notice something that actually is useful.
Any help in form of advice or links is appreciated.26 replies