From 2928382a4dff799ad1430ffc27a61ac37321e06b Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Tue, 27 Feb 2018 12:34:13 +1100 Subject: [PATCH 1/2] Fix the initialisation of Rnd in FlatZinc This commit fixes the passing of the rnd value from main and initialises the default random number generator. --- gecode/flatzinc/flatzinc.cpp | 4 ++-- gecode/flatzinc/parser.tab.cpp | 2 +- gecode/flatzinc/parser.yxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gecode/flatzinc/flatzinc.cpp b/gecode/flatzinc/flatzinc.cpp index b1439441c1..5089733f51 100644 --- a/gecode/flatzinc/flatzinc.cpp +++ b/gecode/flatzinc/flatzinc.cpp @@ -88,8 +88,8 @@ namespace std { namespace Gecode { namespace FlatZinc { - // Unitialized default random number generator - Rnd defrnd; + // Default random number generator + Rnd defrnd(0); /** * \brief Branching on the introduced variables diff --git a/gecode/flatzinc/parser.tab.cpp b/gecode/flatzinc/parser.tab.cpp index af4be5f638..54f7948d66 100644 --- a/gecode/flatzinc/parser.tab.cpp +++ b/gecode/flatzinc/parser.tab.cpp @@ -444,7 +444,7 @@ namespace Gecode { namespace FlatZinc { } if (fzs == NULL) { - fzs = new FlatZincSpace(); + fzs = new FlatZincSpace(rnd); } ParserState pp(data, sbuf.st_size, err, fzs); #else diff --git a/gecode/flatzinc/parser.yxx b/gecode/flatzinc/parser.yxx index 91b0a619a4..acb0053f78 100644 --- a/gecode/flatzinc/parser.yxx +++ b/gecode/flatzinc/parser.yxx @@ -419,7 +419,7 @@ namespace Gecode { namespace FlatZinc { } if (fzs == NULL) { - fzs = new FlatZincSpace(); + fzs = new FlatZincSpace(rnd); } ParserState pp(data, sbuf.st_size, err, fzs); #else From babc0139550ed48838ad01d2621964b146ea70eb Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Wed, 7 Mar 2018 09:45:41 +1100 Subject: [PATCH 2/2] Add changelog entry for Rnd FlatZinc fix --- changelog.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/changelog.in b/changelog.in index d08794e5fe..930ecf5ec6 100644 --- a/changelog.in +++ b/changelog.in @@ -66,6 +66,16 @@ # optional section in the html page. # +[ENTRY] +Module: flatzinc +What: bug +Rank: minor +Thanks: Jip J. Dekker +[DESCRIPTION] +Fixed the initialisation of the random number generator for the +FlatZinc executable. This fix ensures the generator is always +initialised. + [RELEASE] Version: 6.0.0 Date: 2018-02-´23