improvements to speed up variate generation