Placed Lottery Generator logic from controller to Angular factory.