TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Randomness in .NET

75 点作者 lowleveldesign超过 6 年前

7 条评论

redcalx超过 6 年前
I think this is the github issue referred to:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefx&#x2F;issues&#x2F;23298" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefx&#x2F;issues&#x2F;23298</a><p>I wrote some replacement classes that address all of the known issues, here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;colgreen&#x2F;Redzen&#x2F;tree&#x2F;master&#x2F;Redzen&#x2F;Random" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;colgreen&#x2F;Redzen&#x2F;tree&#x2F;master&#x2F;Redzen&#x2F;Random</a><p><a href="https:&#x2F;&#x2F;www.nuget.org&#x2F;packages&#x2F;Redzen&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.nuget.org&#x2F;packages&#x2F;Redzen&#x2F;</a>
评论 #17858550 未加载
nestorD超过 6 年前
Two vital information on .Net PRNG :<p>- It is not thread-safe (and might start outputting a serie of 0 when called in parallel)<p>- There is a bug (acknowledged by Microsoft but not fixed for backward compatibility reasons) in the implementation meaning that the generator has an abnormally short period and is, overall, less random looking.
评论 #17858129 未加载
评论 #17858557 未加载
评论 #17858390 未加载
评论 #17859103 未加载
garganzol超过 6 年前
A useful snippet from the article:<p>&quot;RNGCryptoServiceProvider is generally a safer choice when you need to generate random bytes. Creating an instance of this class is expensive, so it’s better to populate a 400-byte array than call the constructor 100 times to populate a 4-byte array.&quot;
评论 #17858294 未加载
japanuspus超过 6 年前
The blog-post by fuglede with a detailed analysis of the implications of the RNG-bug is well worth a read: <a href="https:&#x2F;&#x2F;fuglede.dk&#x2F;en&#x2F;blog&#x2F;bias-in-net-rng&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fuglede.dk&#x2F;en&#x2F;blog&#x2F;bias-in-net-rng&#x2F;</a>
评论 #17859634 未加载
Insanity超过 6 年前
I might be missing something, but the three predicated values are not in the &quot;nextSeed&quot; table? Whereas the original three are.<p>EDIT: I feel like I miss something in the explanation. Can anyone explain how the seed table is actually used?
评论 #17857835 未加载
评论 #17857821 未加载
iainmerrick超过 6 年前
<i>The algorithm used in the .NET Core is the same as in the .NET Framework</i> [...] <i>There is a difference, however, when we use the default constructor.</i><p>“Core” and “Framework” have different implementations of the same class? Who names these things?
评论 #17858088 未加载
zbigniewc超过 6 年前
Thank you for sharing - I will have to put some work into integrating this with my software that is unfortunately based on a tripleton design pattern, but it&#x27;s worth the effort.
评论 #17858165 未加载