Jun 12, 2012 04:30 PM|gerrylowry|LINK
Re: generate unique codes
Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. One easy way of making sure the codes are unique is to use the primary key to determine the code. So how can I transform an integer into a friendly, say, eight alpha numeric code such that every code is unique?
@ dofoo
dofoo
pretty sure that I generate uinique codes
FWIW, if you requre 'unique codes', 'pretty sure' is insufficient.
i've run variations* on code downloaded from the article http://www.codeproject.com/Articles/14403/Generating-Unique-Keys-in-Net suggested by RameshRajendran above.
N.B.: ¡ almost certainly, duplicates ARE produced !
How Many Unique Codes Can A Smart Key Generate Free
N.B.: ¡ my investigation is not complete !
Cs go case key free generator download. in one test, my first duplicate was encountered after 2 379 101 (two million iterations).
in many tests, i run out of memory ('System.OutOfMemoryException') before encountering a duplicate.
dofoo, i've not tested your method for duplicates; your method should produce more duplicates because it's the hexadecimal value of an Int32 .. the method from
to me, it appears the above string is the major influence on Altaf Al-Amin's algorithm .. you have (26 + 26 + 10) characters for each of eight character positions, i.e., 62 to the eight power .. a very large number but nevertheless a finite number.
WHENEVER one is dealing with finite combinations, if unique values are required, it is prudent to check for duplicates!
g.
How Many Unique Codes Can A Smart Key Generate Card
* code variation (this variation has imperfections, especially in the catch block):
How Many Unique Codes Can A Smart Key Generate FreeComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |