نه اینطوری
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = RandomNumber(1000,9999).ToString();
}
}
}