public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9299] libstdc++: Make spurious std::random_device FAIL less likely
@ 2021-11-24 11:52 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-11-24 11:52 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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

commit r11-9299-ga81eb577eec2ce0e46e202151dc56391e04eeb14
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 aeb7403e830..a351f57b236 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
@@ -42,7 +42,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
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-24 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 11:52 [gcc r11-9299] libstdc++: Make spurious std::random_device FAIL less likely Jonathan Wakely

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).