/** * Calculate random between 2 points, excluding a center * ex: Util.rand(-12, -6, 6, 12) would not return -5 to 5 * @param min1 * @param max1 * @param min2 * @param max2 * @return */ public static int rand(int min1, int max1, int min2, int max2) { return randBool() ? rand(min1, max1) : rand(min2, max2); }
@NotNull public static Location getRandLoc(Location loc, int xRadius, int yRadius, int zRadius) { Location newLoc = loc.clone(); newLoc.setX(ACFUtil.rand(loc.getX()-xRadius, loc.getX()+xRadius)); newLoc.setY(ACFUtil.rand(loc.getY()-yRadius, loc.getY()+yRadius)); newLoc.setZ(ACFUtil.rand(loc.getZ()-zRadius, loc.getZ()+zRadius)); return newLoc; }