This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
std::random_device and Windows CryptoAPI
- From: niXman <i dot nixman at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 2 Aug 2013 20:14:54 +0400
- Subject: 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/