public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r10-10573] libstdc++: Make spurious std::random_device FAIL less likely
Date: Tue, 26 Apr 2022 13:12:56 +0000 (GMT)	[thread overview]
Message-ID: <20220426131256.74216385780D@sourceware.org> (raw)

https://gcc.gnu.org/g:c8f35df75ddfd5bab377721582aafb6a5a1463fe

commit r10-10573-gc8f35df75ddfd5bab377721582aafb6a5a1463fe
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 9 10:31:18 2021 +0000

    libstdc++: Make spurious std::random_device FAIL less likely
    
    It's possible that independent reads from /dev/random and /dev/urandom
    could produce the same value by chance. Retry if that happens. The
    chances of it happening twice are miniscule.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/26_numerics/random/random_device/cons/token.cc:
            Retry if random devices produce the same value.
    
    (cherry picked from commit 8d2d0a6c4391e462555db6d33b2cc00f3da0932f)

Diff:
---
 libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
index 42887703b75..5797571584b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
@@ -41,7 +41,7 @@ test02()
 #ifdef _GLIBCXX_USE_DEV_RANDOM
   std::random_device x1("/dev/urandom");
   std::random_device x2("/dev/random");
-  VERIFY( x1() != x2() );
+  VERIFY( x1() != x2() || x1() != x2() );
 #endif
 }


                 reply	other threads:[~2022-04-26 13:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220426131256.74216385780D@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).