|
| From: | Markus Mützel |
| Subject: | [Octave-bug-tracker] [bug #58800] BIST for rng sometimes fails |
| Date: | Thu, 23 Jul 2020 09:24:13 -0400 (EDT) |
| User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40 |
Follow-up Comment #10, bug #58800 (project octave):
@Michael Leitner: Thanks for the feedback.
The C++11 <random> header seems to provide an interface to a "real" (possibly
non-deterministic) random source:
http://www.cplusplus.com/reference/random/random_device/
https://en.cppreference.com/w/cpp/numeric/random/random_device/random_device
IIUC, it uses /dev/urandom on Linux.
For mingw-w64, it should produce non-deterministic values (using rand_s)
starting with gcc 9.2 (MXE Octave currently uses 9.3):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85494
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rand-s?view=vs-2019
The attached patch adds the C++11 "entropy source" to the Mersenne-Twister
initialization.
It might also be possible that that code block could be used as a replacement
for the code block (just above in the same function) that reads from
/dev/urandom.
If I correctly understand the documentation, the constructor of random_device
might throw an exception. That isn't handled yet. The patch is only for
testing.
@hg200: Could you try if you still see the issue with this patch? (I haven't
tested yet. So I hope it cross-builds and doesn't fail.)
Doing something different on a reset (instead of re-initializing) also sounds
like a good idea to me.
(file #49535)
_______________________________________________________
Additional Item Attachment:
File name: bug58800_random_device.patch Size:0 KB
<https://file.savannah.gnu.org/file/bug58800_random_device.patch?file_id=49535>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58800>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |