Factored out the 'template -> overload' mechanism from random.t