Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class MyClass {
- public static void main(String args[]) {
- int[] numbers = new int[30];
- int generated = 0;
- while(generated != 30) {
- boolean tonno = false;
- int random = (int)(Math.random() * 100);
- for(int i = 0; i < 30; i++) {
- if(numbers[i] == random) {
- tonno = true;
- }
- }
- if(!tonno) {
- numbers[generated] = random;
- generated = generated + 1;
- }
- }
- System.out.println("Generated: ");
- for(int i = 0; i < 30; i++) {
- System.out.print(numbers[i] + " ");
- }
- }
- }
Add Comment
Please, Sign In to add comment