Currently this function only returns a non-zero value for /dev/random and /dev/urandom. When a hardware instruction such as RDRAND is in use it should (in theory) be perfectly random and produce 32 bits of entropy in each 32-bit result. Add a helper function to identify the source of randomness from the _M_func and _M_file data members, and return a suitable value when RDRAND or RDSEED is being used. libstdc++-v3/ChangeLog: * src/c++11/random.cc (which_source): New helper function. (random_device::_M_getentropy()): Use which_source and return suitable values for sources other than device files. * testsuite/26_numerics/random/random_device/entropy.cc: New test. Tested powerpc64le-linux. Committed to trunk.