summaryrefslogtreecommitdiff
path: root/boost/random/linear_congruential.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
commitb8cf34c691623e4ec329053cbbf68522a855882d (patch)
tree34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/random/linear_congruential.hpp
parent3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff)
downloadboost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz
boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2
boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/random/linear_congruential.hpp')
-rw-r--r--boost/random/linear_congruential.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/boost/random/linear_congruential.hpp b/boost/random/linear_congruential.hpp
index de3a1d0749..22ade3f3db 100644
--- a/boost/random/linear_congruential.hpp
+++ b/boost/random/linear_congruential.hpp
@@ -124,8 +124,12 @@ public:
* distinct seeds in the range [1,m) will leave the generator in distinct
* states. If c is not zero, the range is [0,m).
*/
- BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_congruential_engine, IntType, x0)
+ BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_congruential_engine, IntType, x0_)
{
+ // Work around a msvc 12/14 optimizer bug, which causes
+ // the line _x = 1 to run unconditionally sometimes.
+ // Creating a local copy seems to make it work.
+ IntType x0 = x0_;
// wrap _x if it doesn't fit in the destination
if(modulus == 0) {
_x = x0;