Replaced instances of iter::repeat(num) by num.times, changed random number generation to comform to the new api