[refactor] Use `CreateSampleIndices()` in `c_api.cpp` (#4478)
[refactor] Use `CreateSampleIndices()` in `c_api.cpp` (#4478)

This removes code duplication for creating sample indices.
henry0312/LightGBM,microsoft/LightGBM,henry0312/LightGBM,microsoft/LightGBM,microsoft/LightGBM,henry0312/LightGBM,henry0312/LightGBM,henry0312/LightGBM,microsoft/LightGBM,microsoft/LightGBM