Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class ajjajj {
- public static int rngCounter()
- {
- int a;
- Random rand = new Random();
- a = rand.nextInt(99);
- return a;
- }
- public static void PRD()
- {
- Scanner in = new Scanner(System.in);
- String rngg;
- int[] noprocArray;
- noprocArray = new int[100];
- Integer p;
- int tryCounter = 0;
- boolean randomLagi = true;
- boolean seratus = true;
- while(tryCounter != 100)
- {
- p = rngCounter();
- if(p != null)
- {
- while(randomLagi)
- {
- p = rngCounter();
- for(int i = 0; i < noprocArray.length; i++)
- {
- if(tryCounter == 0)
- {
- break;
- }
- else if(p == noprocArray[i])
- {
- randomLagi = true;
- break;
- }
- else
- {
- noprocArray[i] = p;
- randomLagi = false;
- }
- }
- break;
- }
- if(p < 20)
- {
- System.out.printf("Angka Random: %d\n", p);
- System.out.println("proc");
- noprocArray = new int[100];
- //tryCounter++; siapa tau
- System.out.println("RNGG!");
- System.exit(0);
- }
- else
- {
- System.out.printf("Angka Random: %d\n", p);
- System.out.println("noproc");
- tryCounter++;
- System.out.println("Scrubz, press Enter key to try again...");
- rngg = in.nextLine();
- }
- }
- }
- }
- public static void main(String[] args){
- PRD();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement