Re: DBD::Sybase and Sybase::CTlib build problems w/ 5.8.1, Solaris, gcc
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index 7f38135..b196d9b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4412,7 +4412,6 @@ Perl_get_hash_seed(pTHX)
      {
          /* Compute a random seed */
          (void)seedDrand01((Rand_seed_t)seed());
-         PL_srand_called = TRUE;
          myseed = (UV)(Drand01() * (NV)UV_MAX);
 #if RANDBITS < (UVSIZE * 8)
          /* Since there are not enough randbits to to reach all
@@ -4422,8 +4421,13 @@ Perl_get_hash_seed(pTHX)
          myseed +=
               (UV)(Drand01() * (NV)((1 << ((UVSIZE * 8 - RANDBITS))) - 1));
 #endif /* RANDBITS < (UVSIZE * 8) */
+         if (myseed == 0) { /* Superparanoia. */
+             myseed = (UV)(Drand01() * (NV)UV_MAX); /* One more chance. */
+             if (myseed == 0)
+                 Perl_croak(aTHX_ "Your random numbers are not that random");
+         }
      }
-     PL_hash_seed_set = TRUE;
+     PL_new_hash_seed_set = TRUE;
 
      return myseed;
 }