11.02.2016, 22:21
Quote:
Today I learned by trial-error, how to generate a unique UUID ( User Unique ID ) with a prefix!
Код:
stock GenerateUUID() { new UUID[9]; new SALT_LENGTH = 6; new SALT_PREFIX[] = "LRP"; // Change to whatever you want (3 letters only) new SALT[6]; while(SALT_LENGTH--) { SALT[SALT_LENGTH] = ( random(2) ? (random(26) + (random(2) + 'A')) : (random(10) + '0') ); } format(UUID, sizeof(UUID), "%s%s", SALT_PREFIX, SALT); return UUID; } |