海纳百川

登录 | 登录并检查站内短信 | 个人设置 网站首页 |  论坛首页 |  博客 |  搜索 |  收藏夹 |  帮助 |  团队  | 注册  | RSS
主题: 谁能看出来产生陪审团的程序是错的?
回复主题   printer-friendly view    海纳百川首页 -> 众议院
阅读上一个主题 :: 阅读下一个主题  
作者 谁能看出来产生陪审团的程序是错的?   
所跟贴 谁能看出来产生陪审团的程序是错的? -- 随便 - (2226 Byte) 2007-10-18 周四, 上午10:16 (789 reads)
路过
[博客]
[个人文集]
警告次数: 1






加入时间: 2007/06/27
文章: 1578

经验值: 16928


文章标题: 挖塞!竟然有这么大个虫子! (166 reads)      时间: 2007-10-18 周四, 下午8:57

作者:路过众议院 发贴, 来自 http://www.hjclub.org


//replace the chosen name by the last available name in the arry
//so that it will not be selected again.
names [ j ] =names [ n -1 ] ;

应该改为:

// remove the chosen name from the array and
// move the names behind the chosen name up.
int k;
for (k = j; k names [ k ] =names [ k+1 ] ;
}

另,seed 不该定为常数。这样得到的随机数列都是一样的(很可能?)
用个取得当前时刻的函数代替,即可。

另一个重大发现:老随摆弄过二进制。呵呵。

夸自己一句。喝酒去了。。。



作者:路过众议院 发贴, 来自 http://www.hjclub.org
返回顶端
阅读会员资料 路过离线  发送站内短信
显示文章:     
回复主题   printer-friendly view    海纳百川首页 -> 众议院 所有的时间均为 北京时间


 
论坛转跳:   
不能在本论坛发表新主题
不能在本论坛回复主题
不能在本论坛编辑自己的文章
不能在本论坛删除自己的文章
不能在本论坛发表投票
不能在这个论坛添加附件
不能在这个论坛下载文件


based on phpbb, All rights reserved.
[ Page generation time: 0.050643 seconds ] :: [ 19 queries excuted ] :: [ GZIP compression enabled ]