Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int min = 10;
- int max = 20;
- ArrayList<Integer> rand = new ArrayList<>();
- for(i=0;i<10;i++){
- int rands = (int)(Math.random() * (max - min) + min);
- Boolean found = true;
- while(found){
- found = false;
- int c = 1;
- while(c<i&&!found){
- if(rand.get(c) == rands){
- found = true;
- }
- c = c+1;
- }
- if(found){
- rands = (int)(Math.random() * (max - min) + min);
- }
- }
- rand.add(rands);
- System.out.println(rand.get(i));
Add Comment
Please, Sign In to add comment