@Test public void rand_no_arg() { FunctionExpression rand = dsl.rand(); assertEquals(FLOAT, rand.type()); assertTrue( getFloatValue(rand.valueOf(valueEnv())) >= 0 && getFloatValue(rand.valueOf(valueEnv())) < 1); assertEquals("rand()", rand.toString()); }
private static FunctionResolver rand() { return FunctionDSL.define(BuiltinFunctionName.RAND.getName(), FunctionDSL.impl(() -> new ExprFloatValue(new Random().nextFloat()), FLOAT), FunctionDSL.impl( FunctionDSL.nullMissingHandling( v -> new ExprFloatValue(new Random(v.integerValue()).nextFloat())), FLOAT, INTEGER) ); }
MathematicalFunction { private static FunctionResolver rand() { return FunctionDSL.define(BuiltinFunctionName.RAND.getName(), FunctionDSL.impl(() -> new ExprFloatValue(new Random().nextFloat()), FLOAT), FunctionDSL.impl( FunctionDSL.nullMissingHandling( v -> new ExprFloatValue(new Random(v.integerValue()).nextFloat())), FLOAT, INTEGER) ); } }
MathematicalFunction { private static FunctionResolver rand() { return FunctionDSL.define(BuiltinFunctionName.RAND.getName(), FunctionDSL.impl(() -> new ExprFloatValue(new Random().nextFloat()), FLOAT), FunctionDSL.impl( FunctionDSL.nullMissingHandling( v -> new ExprFloatValue(new Random(v.integerValue()).nextFloat())), FLOAT, INTEGER) ); }  }
MathematicalFunction { private static FunctionResolver rand() { return FunctionDSL.define(BuiltinFunctionName.RAND.getName(), FunctionDSL.impl(() -> new ExprFloatValue(new Random().nextFloat()), FLOAT), FunctionDSL.impl( FunctionDSL.nullMissingHandling( v -> new ExprFloatValue(new Random(v.integerValue()).nextFloat())), FLOAT, INTEGER) ); }  static void register(BuiltinFunctionRepository repository); }
MathematicalFunction { private static FunctionResolver rand() { return FunctionDSL.define(BuiltinFunctionName.RAND.getName(), FunctionDSL.impl(() -> new ExprFloatValue(new Random().nextFloat()), FLOAT), FunctionDSL.impl( FunctionDSL.nullMissingHandling( v -> new ExprFloatValue(new Random(v.integerValue()).nextFloat())), FLOAT, INTEGER) ); }  static void register(BuiltinFunctionRepository repository);  }