[PATCH] libc++: add NaCl and PNaCl support for std::random_device

David Majnemer david.majnemer at gmail.com
Thu Nov 27 14:42:28 PST 2014


The purpose of the token is to permit different sources of randomness.  Seeing as how you don't allow anything other than `nacl_secure_random_init`, perhaps you should just make the default token be the empty string in the `<random>` header.

Checking for an invalid token would just be a simple `!__token.empty()`.

================
Comment at: src/random.cpp:79
@@ +78,3 @@
+    else if (bytes_written != n)
+        __throw_runtime_error("random_device failed obtaining enough bytes");
+    return r;
----------------
This read a little funny to me, maybe:
> random_device failed to obtain enough bytes

http://reviews.llvm.org/D6442






More information about the cfe-commits mailing list