更好的Rand()Algorithim [英] Better Rand() Algorithim
问题描述
对于c中的一个程序,我需要一些系统的随机数字,人们可以下注。这不是一个商业项目顺便说一句。一般来说,我倾向于依靠标准库中的东西,因为它们是由人写的
,其技能远高于我的。因此,我总是使用rand()和FALSELY
假设它可以产生不可预测的随机数,并且可以在许多情况下用于
,即使安全性是一个问题。
首先,让我们假设我现在有办法为伪随机数生成器获取一个随机的
不可预测的种子。那么它是否可以获得一个合理安全的随机播放,其中用户无法在看到前五个左右的所有玩家卡后预测所有玩家卡。
系列?
其次,是否有合理的方法来确定不可预测的
种子?我知道从计时器播种是不安全的。
最后,是否有一个更好的rand()传真,其源代码是公共领域可用的
?一个适合我的需求。
TIA Bj
Ben Justice< No *** **@Justice.gov>写道:
< SNIP>最后,是否有一个更好的rand()传真,其源代码在公共领域可用?一个适合我的需求。
尝试: http://www.cs.wm.edu/~va/software/park/park.html
(我在那里找不到任何许可信息,但它变成了研究代码,而不是商业代码。)
或者刚开始:
http:// www。 google.com/search?q=random+number+generators
问候,
Irrwahn
-
闭上眼睛,然后按三次逃生。
Ben Justice写道:对于程序在c中,我需要一些系统的随机数字,人们正在下注。这不是一个商业项目顺便说一句。一般来说,我倾向于依赖标准库中的东西,因为它们是由具有远高于我的技能的人编写的。因此,我总是使用rand()和FALSELY
假设它可以产生不可预测的随机数,并且可以在许多情况下使用,即使安全性是一个问题。
首先,我们假设我有一种方法可以为伪随机数生成器获取随机且不可预测的种子。然后是否有可能得到一个合理安全的洗牌,用户在看到
系列中的前五个左右后无法预测所有玩家卡?
>其次,是否有合理的方法来确定不可预测的种子?我知道从计时器播种是不安全的。
最后,是否有一个更好的rand()传真,其源代码在公共领域可用?一个适合我的需求。
TIA Bj
我认为你应该在这个新闻组中搜索随机< b / b
而不是开始一个全新的讨论。
-
Thomas Matthews
C ++新闻组欢迎辞:
http://www.slack .net / ~shiva / welcome.txt
C ++常见问题: http://www.parashift.com/c++-faq-lite
C常见问题: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c ++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
其他网站:
http://www.josuttis.com - C ++ STL图书馆书籍
Ben Justice写道:
最后,是否有更好的rand()传真,其源代码在公共领域可用?一个适合我的需求。
Google forMersenne Twister。
-
Richard Heathfield: bi****@eton.powernet.co.uk
Usenet是一个奇怪的地方。 - Dennis M Ritchie,1999年7月29日。
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K& R答案,C书等:< a rel =nofollowhref =http://users.powernet.co.uk/etontarget =_ blank> http://users.powernet.co.uk/eton
For a program in c, I need some random numbers for a system were people are
placing bets. This is not a commerical project btw. Generally, I tend to
rely on things from the standard library, because they''re written by people
with skills far above mine. Hence, I''ve always used rand() and FALSELY
assumed it could produce unpredictable random numbers and could be used in
many situations even if security was an issue.
Firstly, lets assume for the moment I have a way to get a random and
unpredictable seed for a pseudo random number generator. Then is it
possible to get a reasonably secure shuffle in which the user cannot
predict all the players cards after seeing the first five or so in the
series?
Secondly, Is there a reasonable method for determing an unpredictatble
seed? I understand seeding from the timer is unsecure.
Finally, is there a better rand() facsimile in which the source code is
available in the public domain? One which would suit my needs.
TIA Bj
Ben Justice <No*****@Justice.gov> wrote:
<SNIP>Finally, is there a better rand() facsimile in which the source code is
available in the public domain? One which would suit my needs.
Try: http://www.cs.wm.edu/~va/software/park/park.html
(I couldn''t find any licensing information there, but it turned
out to be research code, not commercial code.)
Or just get started with:
http://www.google.com/search?q=random+number+generators
Regards,
Irrwahn
--
Close your eyes and press escape three times.
Ben Justice wrote:For a program in c, I need some random numbers for a system were people are
placing bets. This is not a commerical project btw. Generally, I tend to
rely on things from the standard library, because they''re written by people
with skills far above mine. Hence, I''ve always used rand() and FALSELY
assumed it could produce unpredictable random numbers and could be used in
many situations even if security was an issue.
Firstly, lets assume for the moment I have a way to get a random and
unpredictable seed for a pseudo random number generator. Then is it
possible to get a reasonably secure shuffle in which the user cannot
predict all the players cards after seeing the first five or so in the
series?
Secondly, Is there a reasonable method for determing an unpredictatble
seed? I understand seeding from the timer is unsecure.
Finally, is there a better rand() facsimile in which the source code is
available in the public domain? One which would suit my needs.
TIA Bj
I think you should search this newsgroup for "random"
rather than starting a whole new discussion.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
Ben Justice wrote:
Finally, is there a better rand() facsimile in which the source code is
available in the public domain? One which would suit my needs.
Google for "Mersenne Twister".
--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
这篇关于更好的Rand()Algorithim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!