I'm trying to pick two random numbers for assignment 5 of the c# school. I'm using the following code
The trouble is that 90% of the time the two numbers are the same. Occasionally (about 10% of the time) the numbers are different but it is rare. So what am I doing wrong?
I know that computer random isn't really random, but surely it only takes a tick?
Code: (csharp)
private void fillFirstBoxes()
{
userCard1Text.Text = Convert.ToString(functions.GetRandomCard());
dealerCard1Text.Text = Convert.ToString(functions.GetRandomCard());
}
...
public class Functions
{
private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
public int GetRandomCard()
{
int[] cards = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 };
int random = RandomNumber(0, 12);
return cards[random];
}
}The trouble is that 90% of the time the two numbers are the same. Occasionally (about 10% of the time) the numbers are different but it is rare. So what am I doing wrong?
I know that computer random isn't really random, but surely it only takes a tick?













)