Refactored use of random number generation implementation