static Random random_random = new Random; static int random(int n) { return random(random_random, n); } static int random(Random r, int n) { return n <= 0 ? 0 : r.nextInt(n); } static double random(double max) { return random()*max; } static double random() { return random_random.nextInt(100001)/100000.0; } static double random(double min, double max) { return min+random()*(max-min); } // min <= value < max static int random(int min, int max) { return min+random(max-min); } static int random(Random r, int min, int max) { return min+random(r, max-min); } static A random(L l) { ret oneOf(l); } static A random(Collection c) { if (c instanceof L) ret random((L) c); int i = random(l(c)); ret collectionGet(c, i); } ifclass IntRange static int random(IntRange r) { ret random(r.start, r.end); } endif