Skip to content

Instantly share code, notes, and snippets.

@chez14
Last active October 18, 2017 11:41
Show Gist options
  • Save chez14/192bdba2420e4adf3492ba1052f45f57 to your computer and use it in GitHub Desktop.
Save chez14/192bdba2420e4adf3492ba1052f45f57 to your computer and use it in GitHub Desktop.
GANTENG
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