Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Lotto {
- internal class Program {
- private static void Main(string[] args) {
- int[] lotto = new int[6];
- const int MIN = 1;
- const int MAX = 50;
- Random random = new Random();
- for (int i = 0; i < lotto.Length; i++) {
- int rand = random.Next(MIN, MAX);
- for (int j = i - 1; j >= 0; j--) {
- if (lotto[j] == rand) {
- rand = random.Next(MIN, MAX);
- j = i - 1;
- }
- }
- lotto[i] = rand;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement