How can I generate a random number with 5 digits that do not repeat in the range of [10000 - 99999].
using System;
using System.Threading;
namespace ConsoleApp1
{
class Program
{
private static int GetNumeroConta()
{
Random a = new Random(DateTime.Now.Ticks.GetHashCode());
Thread.Sleep(1);
return a.Next(10000, 99999);
}
static void Main(string[] args)
{
int numero = GetNumeroConta();
Console.WriteLine(numero);
Console.ReadKey();
}
}
}