2 adet random tanımladım 2 adet de buton fakat verilen randomlar aynı değerler.
Randomların değişkenleri dahi farklı fakat sonuç aynı
Randomlardan gelen değeri nasıl farklı yapabiliriz?
*ların değerleri:
pictureBox1.Image******** = pictureBox1.ImageL0cation
private **** = private v0id
C:\\Users\\*\\Desktop\\6.jpg= bilgisayar ismi yazılı
Randomların değişkenleri dahi farklı fakat sonuç aynı
Randomlardan gelen değeri nasıl farklı yapabiliriz?
Kod:
private **** button1_Click(object sender, EventArgs e)
{
int a = r.Next(1, 7);
int b = r.Next(1, 7);
topb = a + b;
topb2 = topb2+topb ;
label2.Text = a.ToString();
label4.Text = b.ToString();
label6.Text = topb.ToString();
label15.Text = topb2.ToString();
if (a == 1)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\1.jpg";
}
if (a == 2)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\2.jpg";
}
if (a == 3)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\3.jpg";
}
if (a == 4)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\4.jpg";
}
if (a == 5)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\5.jpg";
}
if (a == 6)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\6.jpg";
}
//------------------------------------------------------------------------------------
if (b == 1)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\1.jpg";
}
if (b == 2)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\2.jpg";
}
if (b == 3)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\3.jpg";
}
if (b == 4)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\4.jpg";
}
if (b == 5)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\5.jpg";
}
if (b == 6)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\6.jpg";
}
}
private **** Form1_Load(object sender, EventArgs e)
{
}
private **** button2_Click(object sender, EventArgs e)
{
int c = x.Next(1,7);
int d = x.Next(1,7);
top =c + d;
label8.Text = c.ToString();
label10.Text = d.ToString();
topp = topp+ top;
label12.Text = top.ToString();
label17.Text = topp.ToString();
if (c == 1)
{
pictureBox1.Image******** = "C:\\Users\\*\Desktop\\1.jpg";
}
if (c == 2)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\2.jpg";
}
if (c == 3)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\3.jpg";
}
if (c == 4)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\4.jpg";
}
if (c == 5)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\5.jpg";
}
if (c == 6)
{
pictureBox1.Image******** = "C:\\Users\\*\\Desktop\\6.jpg";
}
//------------------------------------------------------------------------------------
if (d == 1)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\1.jpg";
}
if (d == 2)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\2.jpg";
}
if (d == 3)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\3.jpg";
}
if (d == 4)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\4.jpg";
}
if (d == 5)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\5.jpg";
}
if (d == 6)
{
pictureBox2.Image******** = "C:\\Users\\*\\Desktop\\6.jpg";
}
}
*ların değerleri:
pictureBox1.Image******** = pictureBox1.ImageL0cation
private **** = private v0id
C:\\Users\\*\\Desktop\\6.jpg= bilgisayar ismi yazılı
Son düzenleme:


