Thank you for your question. You can follow bellow code.
protected string GenerateCode(int NoOfCode)
{
string pinnofinal="";
int d1 = 0;
int d2 = 0;
int d3 = 0;
int d4 = 0;
int d5 = 0;
int d6 = 0;
int d7 = 0;
int d8 = 0;
for (int i = 0; i < NoOfCode; i++)
{
d1 = DateTime.Now.Millisecond + i;
d2 = DateTime.Now.Second + i + 25;
d3 = DateTime.Now.Second + i + 112;
d4 = DateTime.Now.Second + i + 199;
d5 = DateTime.Now.Second + i + 161;
d6 = DateTime.Now.Second + i + 12;
d7 = DateTime.Now.Second + i + 15;
d8 = DateTime.Now.Millisecond + i;
Random newno = new Random();
string ranno = newno.Next(1111, 9999).ToString("x");
string newpinno = ranno + d8.ToString("x") + d1.ToString("x") + d2.ToString("x") + d3.ToString("x") + d4.ToString("x") + d5.ToString("x") + d6.ToString("x") + d7.ToString("x");
pinnofinal = newpinno.Substring(0, 14).ToUpper();
}
return pinnofinal;
}
Thanks,
Mamun