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.
This commit is contained in:
Alexandre Duret-Lutz 2012-05-07 14:36:54 +02:00
parent a2893520ca
commit b9afd8e705

View file

@ -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();