/** * Gets the lowest. * * @return the lowest */ private static int getLowest() { GeneralTaskSettings ps = GeneralTaskSettings.getSettings(); return random .ints(ps.getLowestPitchRange()[0], ps.getLowestPitchRange()[1]) .findAny() .getAsInt(); }
/** * 产生len个[min,max)随机数(jdk8) * * @param min * @param max * @param len * @return */ public static int[] generateRandomArrayWithJava8(int min, int max, int len) { Random random = new Random(); IntStream intStream = random.ints(len, min, max); return intStream.toArray(); }