SHARE
TWEET

Untitled

a guest Sep 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         foo();
  4.     }
  5.  
  6.  
  7.     static void foo() {
  8.         int src = getProperRand();
  9.         System.out.println("scr = " + src);
  10.  
  11.         int dst = getProperRand();
  12.         int count = 1;
  13.         while (src != dst){
  14.             dst = getProperRand();
  15.             count++;
  16.         }
  17.  
  18.         System.out.println("count = " + count);
  19.     }
  20.  
  21.     static int getProperRand() {
  22.         int rand = new Random().nextInt(9_000_000);
  23.         int l = 1_000_000;
  24.         return l + rand;
  25.     }
  26.  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top