Added some templating functionality to generateNumber(...) and generateNums(...).