using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Graphics theGraphics = Graphics.FromHwnd(this.Handle);
bool is_have_random = true;
int count = 0, i = 0, musor = 0, musor2 = 1;
List<int> myRandom = new List<int>();
Random rnd = new Random();
try
{
count = Convert.ToInt32(textBox1.Text);
}
catch (FormatException MyE)
{
MessageBox.Show(MyE.ToString());
}
while (i < count)
{
musor = rnd.Next(1, 36);
foreach (int a in myRandom)
{
if (a == musor)
{
is_have_random = false;
}
}
if (is_have_random)
{
myRandom.Add(musor);
i++;
}
}
foreach (int f in myRandom)
{
MessageBox.Show(f.ToString());
}
}
}
}