This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

std::random_device and Windows CryptoAPI


Hi,

Some time ago, I thought about adding CryptoAPI[1] support for
'std::random_device'. Now, I have some free time, and I want to do it.
But, after the analysis of the 'libstdc++-v3/include/bits/random.h'
and 'libstdc++-v3/src/c++11/random.cc' files, I had a few questions.
Firstly, when building gcc-trunk using MinGW, the
_GLIBCXX_USE_RANDOM_TR1 macro is not defined (I couldn't understand
was it right or not?). Thus, the following methods are used:
'void random_device::_M_init_pretr1(const std::string& token)'
'random_device::result_type random_device::_M_getval_pretr1()'

The 'random_device::_M_getval_pretr1()' method, currently, as a source
of pseudo-random numbers is using the '_M_mt' member of the
'std::mt19937' type. And here I do not understand why this is
happening, is it right, and why it's done that way?

Or maybe, I configure GCC incorrectly, and the _GLIBCXX_USE_RANDOM_TR1
macro must be defined?

Thanks!


[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa380255(v=vs.85).aspx

-- 
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]