[R] allow using seed with regular RNG (#10029)

This commit is contained in:
david-cortes
2024-02-04 09:22:22 +01:00
committed by GitHub
parent 662854c7d7
commit a730c7e67e
7 changed files with 78 additions and 15 deletions

View File

@@ -41,16 +41,6 @@ double LogGamma(double v) {
return lgammafn(v);
}
#endif // !defined(XGBOOST_USE_CUDA)
// customize random engine.
void CustomGlobalRandomEngine::seed(CustomGlobalRandomEngine::result_type val) {
// ignore the seed
}
// use R's PRNG to replacd
CustomGlobalRandomEngine::result_type
CustomGlobalRandomEngine::operator()() {
return static_cast<result_type>(
std::floor(unif_rand() * CustomGlobalRandomEngine::max()));
}
} // namespace common
} // namespace xgboost