REF: Move sampling logic into algorithms.py
https://github.com/pandas-dev/pandas/pull/34069 is implementing a sampling procedure for groupby which then uses the same from core/generic.py, however it may be preferable to implement lower-level code in core/algorithms.py which then both can share.