예제 #1
0
static bool
ExpressionFunctionProbability(const CGContext &/*cg_context*/)
{
	if (Function::reach_max_functions_cnt()) {
		return true;
	}
	return rnd_flipcoin(80);
}
예제 #2
0
Type *CreateRandomMessageType() {
  // Give each type 14 vars, the first four of which are condition flags.
  std::vector<const Type *> types;
  std::vector<CVQualifiers> qfers;
  std::vector<int> bit_len(14, -1);
  const Type *int_type = &Type::get_simple_type(eInt);
  CVQualifiers qfer(std::vector<bool>({false}), std::vector<bool>({false}));
  types.insert(types.end(), 4, int_type);
  qfers.insert(qfers.end(), 4, qfer);
  for (int idx = 0; idx < 10; ++idx) {
    types.push_back(Type::choose_random_simple()->to_unsigned());
    bool is_vol = rnd_flipcoin(50);
    qfers.push_back(CVQualifiers(
        std::vector<bool>({false}), std::vector<bool>({is_vol})));
  }
  return new Type(types, true, false, qfers, bit_len);
}