JexlNumericFunctions implements ExpressionContextVisitor { public String random(Object omin, Object omax) { int min = FunctionHandler.getInt(omin); int max = FunctionHandler.getInt(omax); if (max > min) { return Integer.toString(rnd.nextInt(max - min) + min); } return "0"; }  @Override void visit(JexlContext context); String mod(Object num, Object mod); String add(Object... values); String subtract(Object... values); String random(Object omin, Object omax); String random(Object omax); String randomPositiveWhole(Object olength); String randomNegativeWhole(Object olength); String randomPositiveFloat(Object owhole, Object odecimal); String randomNegativeFloat(Object owhole, Object odecimal); String toInt(String num);  }
@Test @Tag(TestGroups.FUNCTIONAL) public void testRandom() { String result = variables.evaluate("#{numericFunctions.random(two_int, four_float)}"); assertNotNull(result); assertTrue(NumberUtils.createNumber(result).doubleValue() < 4D && NumberUtils.createNumber(result).doubleValue() >= 2D); result = variables.evaluate("#{numericFunctions.random(four_float)}"); assertNotNull(result); assertTrue(NumberUtils.createNumber(result).doubleValue() < 4D && NumberUtils.createNumber(result).doubleValue() >= 0D); }