private string genrandom(int count) { string var ="A-Z,0-9"; // for the above code use A to z characters and 0 to 9 nos string[] verifycode = var.Split(','); int t=-1; // temp varaiable string finalcode =string.Empty; Random rand = new Random(); for (int i = 0; i < count; i++) { if t!= -1) { rand = new Random(i * t* ((int)DateTime.Now.Ticks)); } int t1 = rand.Next(36); if t!= -1 && temp == 1 { return genrandom(count); } t= t1; finalcode += verifycode [t1]; } return finalcode; }
Login to post response