本文介绍了VS2010中random_device的实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 根据我对标准的阅读,如果使用软件引擎, code>,根据MSDN是 RtlGenRandom 的别名。这由VC ++ 2010提供的运行时库源验证: random_device :: operator()() < random> 调用以下函数链: _Random_device )// in xrngdev.cpp rand_s()// in rand_s.c RtlGenRandom()/ SystemFunction036()// in advapi32.dll pre> 根据Michael Howard在他的一篇博客文章上留下的评论,在Windows上不使用CryptoAPI的加密安全随机数, RtlGenRandom 使用以下命令:在编写安全代码第2版的第8章中有一个完整的解释(包括图表)。 From my reading of the standard, random_device::entropy() should return 0.0 if a software engine is used. However, in VS2010 it returns 32.0, which in my understanding requires hardware to produce non-deterministic random numbers.How does VS2010's random_device generate the number sequence? 解决方案 According to a comment left on this question by Hans Passant, random_device uses advapi32:SystemFunction036, which according to MSDN is an alias for RtlGenRandom. This is verified by the runtime library source provided with VC++ 2010:random_device::operator()() in <random> calls the following chain of functions:_Random_device() // in xrngdev.cpp rand_s() // in rand_s.c RtlGenRandom()/SystemFunction036() // in advapi32.dllAccording to a comment left by Michael Howard on one of his blog articles, "Cryptographically Secure Random number on Windows without using CryptoAPI", RtlGenRandom uses the following:There's a full explanation (including diagrams) in Chapter 8 of Writing Secure Code, 2nd Edition. 这篇关于VS2010中random_device的实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-15 06:37