First of all I am not an expert with C#, so I would appreciate answers that are simplied. And thanks in advance..
I have an array with 30 elements all integers and different than each other. I want to make an another array with length of 6. And appoint elements from 30length one to here but i dont want a number to appear more than one. I tried random function which obviously makes it possible to appear same numbers there. I could add statements maybe, but i thought there must be a short way.
I would like to ask you folks if there is, if so please share with me, thanks again.
int [] nums = new int[30];
for (int i = 0; i < nums.Length; i++)
{
nums[i] = i + 1;
}
Random rnd = new Random();
int[] card1 = new int[6];
for (int i = 0; i < card1.Length; i++)
{
card1[i] = nums[rnd.Next(0, 30)];
}