// Allison Obourn, CSE 142 // Simulates drawing up to 10 lotto numbers and stopping if a 7 is drawn. import java.util.*; public class Lotto { public static void main(String[] args) { Random rand = new Random(); System.out.println(seven(rand)); } // picks up to 10 lotto numbers. If a 7 is picked, stops and returns true. // If no 7 was picked, returns false after 10 tries. public static boolean seven(Random rand) { for (int i = 0; i < 10; i++) { int num = rand.nextInt(30) + 1; System.out.print(num + " "); if (num == 7) { return true; } } return false; } }