Closed
Description
Testing environment:
- Emscripten-1.20.0 ( with fastcomp )
- nodejs-0.10.25
- Ubuntu-14.04
Sample code:
#include <random>
#include <iostream>
#include <exception>
auto main()
-> int
try
{
std::random_device rd;
}
catch( const std::exception& e )
{
std::cerr << e.what();
}
Result of the sample:
random_device failed to open /dev/urandom: No such file or directory
The exception thrown from maybe: https://github.com/kripken/emscripten/blob/master/system/lib/libcxx/random.cpp#L53
26.5.6 of the C++ specification:
A random_device uniform random number generator produces non-deterministic random numbers. If implementation limitations prevent generating non-deterministic random numbers, the implementation may employ a random number engine.
I think, Emscripten's std::random_device
constructor is need specific token. Or, it need /dev/urandom
emulation.
Metadata
Metadata
Assignees
Labels
No labels