public static int[] RandomNumbers(int n,int min,int max)
{
    Random rnum = new Random();
    HashSet<int> hset = new HashSet<int>();
    while (hset.Count < n)
        hset.Add(rnum.Next(min,max));
    int[] OutPut = hset.ToArray();
    return OutPut;
}