code: public static double[] randomDoubleArray(int len, Random r) {
      final double[] ret = new double[len];
      for(int i = 0; i < len; i++) {
        ret[i] = r.nextDouble();
      }
      return ret;
    }
docs: Produce an array of random numbers in [0:1].
  
  @param len Length
  @param r Random generator
  @return Array