using System;
using System.Linq;
namespace Loto
{
class Program
{
static void Main(string[] args)
{
short[] tirage = new short[6]; //array that contains the numbers
short nbTirage; //the number randomed
for (int i = 0; i < 6; i++)
{
nbTirage = NombreAleatoire();
while (tirage.Contains(nbTirage)) //if the number has already been drawn
{
nbTirage = NombreAleatoire(); //we random another one
}
Console.Write(nbTirage + " "); //writing the result
}
}
static short NombreAleatoire()
{
Random nb = new Random();
return …
Run Code Online (Sandbox Code Playgroud)