kripken/emscripten — pull request #2447 by usagi (2014-06-24 14:16:27+00:00)
Title: update to use cryptographic random if it is available

The pull-request based on https://github.com/kripken/emscripten/issues/2439#event-134356617.

References:
- https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#RandomSource-description
- https://developer.mozilla.org/ja/docs/Web/API/window.crypto.getRandomValues#Browser_Compatibility
- http://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback

----
Result of `python tests/runner.py test_random_device`

- nodejs-0.10.25

```
test_random_device (test_core.default) ... (checking sanity from test runner)
INFO root: (Emscripten: Running sanity checks)
ok

----------------------------------------------------------------------
Ran 1 test in 1.584s

OK
```
----
And, I tested Firefox-30 and Chromium-35 on Ubuntu-14.04 that is ok.
( The test is modify the code simply, add a logging in the code path and call std::random() and read std::ifstream("/dev/[u]random"). )