且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用RSA或des,md5生成随机数生成器?

更新时间:2023-02-06 09:37:46

我不会使用其中任何一个生成随机数生成器:它们都不产生随机的数据.看起来似乎不错,但是统计分析几乎可以肯定会显示出模式-这不是您在随机数生成器中想要的模式.

为什么不只使用随机类 [
I wouldn''t use any of them to make a random number generator: none of them generate data which is random. It may look it, but statistical analysis will almost certainly show patterns - which is not what you want in a random number generator.

Why not just use the Random class[^]?
private Random rand = new Random();
...
for(int i = 0; i < 10; i++)
   {
   Console.WriteLine(rand.Next(100).ToString());
   }

会给您10个随机数,范围在0到99之间(含0和99).

在短语这不是您想要的随机数生成器中"中插入"not"(不),我该怎么想呢?容易...-OriginalGriff [/edit]

Will give you 10 random numbers between 0 and 99 inclusive.

[edit]"not" inserted in the phrase "which is not what you want in a random number generator" How could I miss that? Easy... - OriginalGriff[/edit]


回答后续问题:

因此,这是学校的任务...在这种情况下,不要指望太多帮助.
但是,如果您从此处开始,则可以解决问题: http://en.wikipedia.org/wiki/Random_number_generation#Computational_methods [^ ].一种算法就在此页面上.另外,请尝试按照本文档中的参考文献查找算法.

—SA
To answer the follow-up Question:

So, this is a school assignment… In this case, don''t count on much help.
However, you can solve your problem if you start from here: http://en.wikipedia.org/wiki/Random_number_generation#Computational_methods[^]. One of the algorithm is right on this page. Also, try to find the algorithms following the references from this document.

—SA