From 7fdd2c36aa1658c193274c320f595bc65c79e4b5 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 30 Jan 2024 14:21:47 -0500 Subject: [PATCH] Change RNG to boost::mixmax --- src/stan/services/util/create_rng.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/stan/services/util/create_rng.hpp b/src/stan/services/util/create_rng.hpp index 9d3b79a1d3..231b57170b 100644 --- a/src/stan/services/util/create_rng.hpp +++ b/src/stan/services/util/create_rng.hpp @@ -1,11 +1,11 @@ #ifndef STAN_SERVICES_UTIL_CREATE_RNG_HPP #define STAN_SERVICES_UTIL_CREATE_RNG_HPP -#include +#include namespace stan { -using rng_t = boost::ecuyer1988; +using rng_t = boost::random::mixmax; namespace services { namespace util { @@ -26,12 +26,7 @@ namespace util { * @return an stan::rng_t instance */ inline rng_t create_rng(unsigned int seed, unsigned int chain) { - using boost::uintmax_t; - static constexpr uintmax_t DISCARD_STRIDE = static_cast(1) << 50; - rng_t rng(seed); - // always discard at least 1 to avoid issue with small seeds for certain RNG - // distributions. See stan#3167 and boostorg/random#92 - rng.discard(std::max(static_cast(1), DISCARD_STRIDE * chain)); + rng_t rng(seed + chain); return rng; }