introduced mocking for random number generation