Various bugfixes and additions
This commit is contained in:
parent
14c3182200
commit
44876f0926
24 changed files with 889 additions and 187 deletions
|
|
@ -86,8 +86,11 @@ functor_t LanguageTable::get_random_function() const
|
|||
return rng.choice(pimpl->functions);
|
||||
}
|
||||
|
||||
token_t LanguageTable::get_random_function(unsigned arity) const
|
||||
token_t LanguageTable::get_random_function(token_t token, unsigned arity) const
|
||||
{
|
||||
if (pimpl->functions_per_arity.size() <= arity || pimpl->functions_per_arity[arity].empty()) {
|
||||
return token; // return original token if no functions of this arity are found
|
||||
}
|
||||
return rng.choice(pimpl->functions_per_arity[arity]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class LanguageTable {
|
|||
Sym get_random_const() const;
|
||||
|
||||
functor_t get_random_function() const;
|
||||
token_t get_random_function(unsigned arity) const;
|
||||
token_t get_random_function(token_t org, unsigned arity) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Reference in a new issue