I'm trying to make a program that switches the location of button1 whenever it gets pressed. For some odd reason, random isn't randomming so well. Button1 just keeps going along the same diagonal line that's slanted at -45 degrees.
public void button1_Click(object sender, EventArgs e)
{
int tempX, tempY;
Random but1X = new Random();
tempX = but1X.Next(10, 500);
Random but1Y = new Random();
tempY=but1Y.Next(60,490);
button1.Location = new Point(tempX, tempY);
}
I've heard that the reason for this is because I keep making a new instance of random whenever button1 gets pressed but when I've tried putting the random code in a method, I still get the same results. Any idea how I can get this button to actually move randomly, rather than just going up and down the slide?