A mock generator to replace Math.random() for testing