Changed Random into an interface and implementation to allow mocking