This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Slightly more intelligent paranoia.
[perl5.git] / util.c
diff --git a/util.c b/util.c
index 39122be..c750a2e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4422,8 +4422,11 @@ Perl_get_hash_seed(pTHX)
          myseed +=
               (UV)(Drand01() * (NV)((1 << ((UVSIZE * 8 - RANDBITS))) - 1));
 #endif /* RANDBITS < (UVSIZE * 8) */
-         while (myseed == 0) /* Superparanoia. */
-             myseed += (UV)(Drand01() * (NV)UV_MAX);
+         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;