Untitled

 avatar
unknown
plain_text
4 years ago
536 B
8
Indexable
for(j = 1; j <= 7; j++)
    {
        random = rand() % 35 + 1;
	while(lottoNumbs[j] == 0)
	{
		if(lottoNumbs.Contains(random) == false)
		{
		 lottoNumbs[j] = random;
		}
	}
     }
//Andra sättet
for(j = 1; j <= 7; j++)
    {
        random = rand() % 35 + 1;
	while(lottoNumbs[j] == 0)
	{
		bool isUnique = true;
		for(k = 1; k <= lottoNumbs.Length; k++)
		{
			if(lottoNumbs[j] == random)
			{
			isUnique = false;
			break;
			}
		}
		if(isUnique == true)
		{
			lottoNumbs[j] = random;
		}
	}
     }
Editor is loading...