Added the random distribtion code for section 1.2