From b9afd8e70537809d8020e6f2f5523de0b57da0c6 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 7 May 2012 14:36:54 +0200 Subject: [PATCH] Fix mismatch between srand/srand48 and rand/rand48. Because only the configure macros of spot::srand() had been updated to the introduction of _config.h, rand() was used even if drand48() was available, and yet srand48() was being called by spot::srand(). The consequence is that setting the seed with srand48() had not effect on the value returned by rand(). Reported by Etienne Renault. * src/misc/random.cc (drand): Fix configure macros used. --- src/misc/random.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/misc/random.cc b/src/misc/random.cc index ac966e872..75a8fa56d 100644 --- a/src/misc/random.cc +++ b/src/misc/random.cc @@ -1,5 +1,8 @@ -// Copyright (C) 2004, 2011 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// -*- coding: utf-8 -*- +// Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). +// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -38,7 +41,7 @@ namespace spot double drand() { -#if HAVE_SRAND48 && HAVE_DRAND48 +#if SPOT_HAVE_SRAND48 && SPOT_HAVE_DRAND48 return ::drand48(); #else double r = ::rand();