Zweanslord / Stersectas

Interstellar civilizations carve their own path through space.
0 stars 0 forks source link

Improve readability generated Id's #19

Open Zweanslord opened 8 years ago

Zweanslord commented 8 years ago

Currently using Java's UUID's randomUUID to generate identification string's in repositories, which are used in url's of pages, such as a game. These are long identifiers such as: C3A21EBF-24FE-469B-A9E1-7DE099A4E77E, making use of hexadecimal characters. This means url's will be long too and a shorter Id would be more readable.

The identifiers can use more characters than just hexidecimal, such as upper- and lowercase characters from the alphabet in combination with numbers. An implementation could make use of java's SecureRandom to generate X numbers between 1 and the maximum of the alphabet used and mapping the number to a character. X could be 8, or a reasonable number could be calculated with the Birthday Problem to ensure a very low chance on collision, the chance to get an already used identifier.