Fortran Coder

产生的随机数不随机。

查看数: 9215 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-5-18 23:56

正文摘要:

产生1~100的随机数,统计结果如下,第一个区间少了一块。不知道是哪里有问题。 [Fortran] 纯文本查看 复制代码 program random implicit none real :: x integer :: up open(7,file='randnums.txt') call random_see ...

回复

fcode 发表于 2016-5-19 08:25:10
x = floor((up-1)*x)+1
改为
x = floor(up*x)+1

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-20 03:13

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表