Fix #8864 (Random selection with subsampling broken)