- for random numbers
static Random _r = new Random();
static int F()
{
int n = _r.Next(0,36);
return n;
}
1a) - if you want to make bingo card
static void Main()
{
//if you want card with 6 numbers
int\[\] numbers = new int\[6\];
//to put different numbers at each place on the array
for (int i = 0; i < numbers.Length; i++)
{
int a = F();
bool has = numbers.Contains(a);
if (has == true) {i--; }
else {
numbers\[i\]=a;
}
}
//to sort it and print it
Array.Sort(numbers);
int j = 0;
foreach (int i in numbers)
{
Console.WriteLine("number at place " + (j+1).ToString() +" is " +i.ToString());
j++;
}
Console.ReadLine();
}
static Random \_r = new Random();
static int F()
{
int n = \_r.Next(0,36);
return n;
}
for horses and chances of winning
static void Main(string[] args)
{
int a = F();
//if random number wich is between 1 and 100 is smaler or equal 80 than horse win
if (a <= 80)
{
Console.Write("horse win!");
}
//else horse lose
else { Console.Write("horse lose!"); }
//and to check what is current value of number a - wich is number between 1 and 100
Console.Write(" value of a is " + a.ToString());
Console.ReadLine();
}
static Random _r = new Random();
static int F()
{
int n = _r.Next(1, 100);
return n;
}