Hi I have got this code for create random number it's working fine..returning the random number but I have a doubt It may be generate the same number some time.. Please any one give me your suggestion will have chance to generate same number???? if have give me a solution..This is the code set what I have used for create the random number
public string GetUniqueKey()
{
int maxSize = 6;
char[] chars = new char[62];
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
byte[] data = new byte[1];
using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
{
crypto.GetNonZeroBytes(data);
data = new byte[maxSize];
crypto.GetNonZeroBytes(data);
}
StringBuilder result = new StringBuilder(maxSize);
foreach (byte b in data)
{
result.Append(chars[b % (chars.Length)]);
}
return result.ToString();
}