From 2227ad60cf4335492fdd0584d48de9609c2f5203 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 21 Aug 2014 13:23:36 +0200 Subject: [PATCH] randltl: do not reset the seed between formulas Reported by Joachim Klein. * src/bin/randltl.cc: Here. * NEWS: Mention the fix. --- NEWS | 4 ++++ src/bin/randltl.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c1956b8fe..d061cb4e9 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,10 @@ New in spot 1.2.4a (not yet released) this was actually hiding the formulas for people using a terminal with white background... This version displays formula in bright blue instead. + - 'randltl -n -1 --seed 0' and 'randltl -n -1 --seed 1' used to + generate nearly the same list of formulas, shifted by one, + because the PRNG write reset with an incremented seed between + each output formula. The PRNG is now reset only once. New in spot 1.2.4 (2014-05-15) diff --git a/src/bin/randltl.cc b/src/bin/randltl.cc index d32cd7d19..676c044e5 100644 --- a/src/bin/randltl.cc +++ b/src/bin/randltl.cc @@ -379,9 +379,10 @@ main(int argc, char** argv) error(2, 0, "No atomic proposition supplied? Run '%s --help' for usage.", program_name); + spot::srand(opt_seed); + typedef Sgi::hash_set > fset_t; - fset_t unique_set; spot::ltl::ltl_simplifier simpl(simplifier_options()); @@ -392,7 +393,6 @@ main(int argc, char** argv) unsigned trials = MAX_TRIALS; bool ignore; const spot::ltl::formula* f = 0; - spot::srand(opt_seed++); do { ignore = false;