Last active
October 18, 2017 11:41
-
-
Save chez14/192bdba2420e4adf3492ba1052f45f57 to your computer and use it in GitHub Desktop.
GANTENG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Pool | |
{ | |
public static boolean validity(int min, int max){ | |
Random rd = new Random(); | |
int lottery1 = rd.nextInt(max-min)+min; | |
int lottery2 = rd.nextInt(max-min)+min; | |
int lottery3 = rd.nextInt(max-min)+min; | |
System.out.println(lottery1); | |
System.out.println(lottery2); | |
System.out.println(lottery3); | |
String lottery = lottery1+lottery2+lottery3+""; | |
boolean check = true; | |
for(int i=0;i<lottery.length()-1;i++){ | |
for(int a=i+1;a<lottery.length();a++){ | |
if(lottery.charAt(i)==lottery.charAt(a)){ | |
return false; | |
} | |
} | |
} | |
return check; | |
} | |
public static void main(String[] kambing){ | |
System.out.println(validity(12,100)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment