public static string CreateRandomNumber()
{
return GenerateRandomPhoneNumber(3);
}
private static string GenerateRandomPhoneNumber(int seed)
{
string phoneNumber = String.Empty;
Random random = new Random((int)(DateTime.Now.Ticks % 5000000000 + seed));
phoneNumber += random.Next(1, 10).ToString();
for (int i = 0; i < 9; i++)
{
phoneNumber += random.Next(0, 10).ToString();
}
return phoneNumber;
}
No comments:
Post a Comment