Random generator = new Random();int n = generator.nextInt(a); // 0 <= n < adouble x = generator.nextDouble(); // 0 <= x < 1