コード例 #1
0
 @Override
 public ExprTree mutateExprTree(ExprTree ptree, ExprTreeSchema schema, IRandGen randgen) {
   // Copy of expr
   ExprTree stree = ptree.copy();
   // Node selection
   int selectIndex = randgen.choose(0, ptree.size());
   // Mutated node
   IPrimitive oldBlock = stree.getBlock(selectIndex);
   Class<?> rtype = oldBlock.returnType();
   int arity = oldBlock.argumentTypes().length;
   IPrimitive newBlock = schema.getAnyBlock(rtype, randgen, arity);
   stree.setBlock(newBlock, selectIndex);
   // Return result
   return stree;
 }
コード例 #2
0
ファイル: Interval.java プロジェクト: Keyblader/jclec4-base
 /** {@inheritDoc} */
 public double getRandom(IRandGen randgen) {
   return randgen.uniform(efLeft(), efRight());
 }