TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How robust is C#'s pseudo-random number generator?

1 pointsby mydpyover 11 years ago
Anyone have a reference for a robust analysis of C#&#x27;s uniform pseudo-random number generator? I am writing something that uses the Random class and want to make sure it satisfies marsaglia &#x2F; bruce schmeiser&#x27;s criteria for RNGs. I don&#x27;t even know if it uses mersenne twister, for example; I was hoping since C# is popular enough I might save some time using the legwork of others. If nothing is out there, I might put together an analysis myself.<p>Any help is appreciated. Thanks, Myles

1 comment

stonemetalover 11 years ago
The standard one in System.Random uses Donald E. Knuth&#x27;s subtractive random number generator algorithm according to the documentation. Which shouldn&#x27;t be too hard to find an anlysis on. <a href="http://msdn.microsoft.com/en-us/library/system.random(v=vs.110).aspx" rel="nofollow">http:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;system.random(v=vs.1...</a><p>Then there is the Cryptographically secure one over in System.Security.Cryptography.RandomNumberGenerator I believe it uses CryptGenRandom under the hood, so I believe it has been analysed.
评论 #6673393 未加载