From 852cb0e37b325ca9e0e668d37f4e2797c4512c1f Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 24 Oct 2025 06:21:17 +0200 Subject: [PATCH] Improve performance of splitmix discard --- include/boost/random/splitmix64.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/boost/random/splitmix64.hpp b/include/boost/random/splitmix64.hpp index dd89ab5ce..9ea10a623 100644 --- a/include/boost/random/splitmix64.hpp +++ b/include/boost/random/splitmix64.hpp @@ -116,10 +116,7 @@ class splitmix64 /** Advances the state of the generator by @c z. */ inline void discard(std::uint64_t z) noexcept { - for (std::uint64_t i {}; i < z; ++i) - { - next(); - } + state_ += z * UINT64_C(0x9E3779B97F4A7C15); } /**