I am using Visual Studio 2010 and C#. I am having problems making my three dice generate different random numbers. All of the dice roll at the same time. I have pictures of dice that I want to pull up for each of 3 dice according to what random number was generated. But when the pictures generate, it is the same picture (aka same number) for all 3 dice. I tried at first to make all three dice pull a random number from the same method, then I tried to make a separate random method for each dice (i.e., randomNum1(), randomNum2(), etc,) but either way I still get the same pic (same random? number) on all dice. What am I doing wrong? (FYI, I am using a button_Click event handler to enable a timer, which in turn uses a timer_Tick event handler to simulate the dice being rolled. It works great until the rolls end and I want to show what random numbers were generated for the dice. The following code is shown at the end of the _Tick event.)
private void timer_Tick(object sender, EventArgs e) {
{...code for animated dice rolls...}
int num1 = randomNum(1, 6);
dice1PictureBox.Image = Image.FromFile("C:\\dice\\front" + num1 + ".jpg");
int num2 = randomNum(1,6);
dice2PictureBox.Image = Image.FromFile("C:\\dice\\front" + num2 + ".jpg");
int num3 = randomNum(1,6);
dice3PictureBox.Image = Image.FromFile("C:\\dice\\front" + num3 + ".jpg");
timer.Enabled = false;}
private int randomNum(int min, int max) {
Random random = new Random();
return random.Next(min, max); }