Quote:
How to generates N no of 6 digit unique key (no duplicate)
You need a 2 steps procedure
- you need to manage a counter which have the task to give unique values. It is the only practical way to go ensure numerous unique keys over a long periods of time.
- Then you need a function that will encode that value in base 62.
The base962 function can look something like:
public static string ToBase62(int Value, int Digits)
{
char[] chars = new char[62];
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
if (Digits==0) return"";
return ToBase62(Value/(chars.Length), Digits-1).Append(chars[Value % (chars.Length)]);
}