Made factorial distribution work over a rangewq