std::random_device and Windows CryptoAPI

Jonathan Wakely jwakely.gcc@gmail.com
Fri Aug 2 13:55:00 GMT 2013


Please ask this on the libstdc++ list instead.

On 1 August 2013 23:37, niXman <i.nixman@gmail.com> wrote:
> 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/



More information about the Gcc-help mailing list