include random_term.hpp, change template interface