Speed-up the generation of random numbers

The previous code would call to_a on a given range. With large ranges this was slow and memory intensive.
Initializing a Random instance and using the instance method 'rand' is far more efficient for ranges.