weimingz added a comment.

We can wrap the random_device as a minstd_rand, a linear congruential enginer 
that a lot of C lib uses for rand().
However based on documentation, we should just provides dummy implementation 
which throws an exception in the constructor of random_device [1,2]
But compared with run-time exception, a link time error is better if we simply 
skip the implementation. Any thoughts?

[1]

> explicit random_device(const string& token = implementation-defined );
>  ...
>  Throws: A value of an implementation-defined type derived from exception if 
> the random_device could not be initialized.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf section 
29.6.6  Class random_device (page 1082)

[2]

> Notice that random devices may not always be available to produce random 
> numbers (and in some systems, they may even never be available). This is 
> signaled by throwing an exception derived from the standard exception or when 
> a number is requested with operator()

http://www.cplusplus.com/reference/random/random_device/


Repository:
  rCXX libc++

https://reviews.llvm.org/D41316



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to