From 265b60bbfd94b3cc50c3c234a70407448aeb84f9 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Sun, 12 Nov 2023 11:20:43 +0100 Subject: [PATCH] add check whether sequence length is exhausted --- ql/math/randomnumbers/burley2020sobolrsg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ql/math/randomnumbers/burley2020sobolrsg.cpp b/ql/math/randomnumbers/burley2020sobolrsg.cpp index f395a788d3e..ec441ee21b7 100644 --- a/ql/math/randomnumbers/burley2020sobolrsg.cpp +++ b/ql/math/randomnumbers/burley2020sobolrsg.cpp @@ -19,6 +19,7 @@ #include #include +#include namespace QuantLib { @@ -136,7 +137,8 @@ namespace QuantLib { nested_uniform_scramble(integerSequence_[i], static_cast(seed)); } } while (i < dimensionality_); - ++nextSequenceCounter_; + QL_REQUIRE(++nextSequenceCounter_ != 0, + "Burley2020SobolRsg::nextIn32Sequence(): period exceeded"); return integerSequence_; }