Generates a random integer between the specified values.


@param lo the lower bound for the generated integer.
@param hi the upper bound for the generated integer.
@return a random integer between <code>lo</code> and <code>hi</code>.
482844
public static int randomInt(int lo, int hi) {
        return (Math.abs(random.nextInt()) % (hi - lo + 1)) + lo;
    }
370197
public static long encodeHi(long encoded, int hi) {
        long h = ((long) hi) & 0xFFFF_FFFFL;
        long l = encoded & 0xFFFF_FFFFL;
        return (h << 32) + l;
    }
902775
@Override
    public E getRandomValue() {
        int randomIndex = random.nextInt(enumConstants.size());
        return enumConstants.get(randomIndex);
    }
899845
public static double[] random(double lo, double hi, int n) {
        double[] x = new double[n];
        random.get().nextDoubles(x, lo, hi);
        return x;
    }
757344
public static long encode(int hi, int lo) {
        long h = ((long) hi) & 0xFFFF_FFFFL;
        long l = ((long) lo) & 0xFFFF_FFFFL;
        return (h << 32) + l;
    }
928155
public static int nextInt(Random random, int min, int max) {
		Validate.isTrue(max >= min, "Start value must be smaller or equal to end value.");
		MoreValidate.nonNegative("min", min);

		if (min == max) {
			return min;
		}

		return min + random.nextInt(max - min);
	}
778566
def randint(self, a: int, b: int, n: Optional[int] = None) -> Union[List[int], int]:
        
        max_n = self.config.MAX_NUMBER_OF_INTEGERS
        return self._generate_randoms(self._request_randints, max_n=max_n, a=a, b=b, n=n)
603303
public static List<Integer> randomizeWithinLimit(int limit) {
        List<Integer> list = new ArrayList<Integer>(limit);
        for (int i = 0; i < limit; i++) {
            list.add(i);
        }
        Collections.shuffle(list, new Random());
        return list;
    }
303553
public static long random(final long randomStart)
    {
        long randomValue = randomStart;
        randomValue ^= (randomValue << 21);
        randomValue ^= (randomValue >>> 35);
        randomValue ^= (randomValue << 4);

        return randomValue;
    }
95930
public static int randomIntGreaterThan(int minExclusive) {
    checkArgument(
        minExclusive < Integer.MAX_VALUE, "Cannot produce int greater than %s", Integer.MAX_VALUE);
    return randomInt(minExclusive + 1, Integer.MAX_VALUE);
  }
19147
public static int getBoundedNumber(Random random, int inclusiveLowerBound,
            int exclusiveUpperBound) {
        return random.nextInt(exclusiveUpperBound - inclusiveLowerBound) +
                inclusiveLowerBound;
    }
901113
public static Object setEL(Object o, int index, Object value) {
	try {
	    return set(o, index, value);
	}
	catch (ArrayUtilException e) {
	    return null;
	}
    }
518322
public org.grails.datastore.mapping.query.api.Criteria between(String propertyName, Object lo, Object hi) {
        if (!validateSimpleExpression()) {
            throwRuntimeException(new IllegalArgumentException("Call to [between] with propertyName [" +
                    propertyName + "]  not allowed here."));
        }

        propertyName = calculatePropertyName(propertyName);
        addToCriteria(Restrictions.between(propertyName, lo, hi));
        return this;
    }
492059
public double nextDouble(double lo, double hi) {
        if (lo < 0) {
            if (nextInt(2) == 0)
                return -nextDouble(0, -lo);
            else
                return nextDouble(0, hi);
        } else {
            return (lo + (hi - lo) * nextDouble());
        }
    }
953392
public double repairSolutionVariableValue(double value, double lowerBound, double upperBound) {
    if (lowerBound > upperBound) {
      throw new JMetalException("The lower bound (" + lowerBound + ") is greater than the "
          + "upper bound (" + upperBound+")") ;
    }
    double result = value ;
    if (value < lowerBound) {
      result = randomGenerator.getRandomValue(lowerBound, upperBound) ;
    }
    if (value > upperBound) {
      result = randomGenerator.getRandomValue(lowerBound, upperBound) ;
    }

    return result ;
  }
384209
function randomIntInRange(low, high) {
    return Math.round(low + (Math.random() * (high - low)));
  }
485305
private void reverseRange(Buffer a, int lo, int hi) {
    hi--;
    while (lo < hi) {
      s.swap(a, lo, hi);
      lo++;
      hi--;
    }
  }