作者s8752199 (s8752199)
看板C_and_CPP
标题Re: [问题] 随机乱数rand()的问题
时间Mon Jun 1 11:11:29 2009
请问有人知道random.org是用什麽方法取乱数的吗?
看它网站说它产生的是true random numbers
谢谢
※ 引述《chin2049 (香吉士)》之铭言:
: #include<iostream>
: #include<stdlib.h>
: #include<ctime>
: using namespace std;
: int main(){
: srand( static_cast<unsigned int>(time(NULL))); //随机函式
: int a = 11 + static_cast<int>( 1. * rand() * 10 / (RAND_MAX + 1.));
: cout << a << endl;
: system("pause");
: return 0;
: }
: 请教一下各位大大
: 我想要产生11~20的随机乱数
: 但是为什麽执行结果都相同呢?
: 我是用深度学习C++自学
: 我是照书上打的
: 请问这个改良式的乱数产生方法哪里错了呢?
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.222.31.187
1F:推 varg:用algo生出来的都是pseudo random numbers 06/01 11:20
2F:推 Ebergies:我去看了一下, 它不是使用演算法计算而是用检测大气noise 06/01 11:56
3F:→ Ebergies:的方法, 感觉是有可能产生 true random number 06/01 11:56
4F:推 chrisdar:大气杂讯就不能重现 除非时光机器了 XD 06/01 11:58
5F:推 varg:当然不能重现 能推得出来的都不是真正随机数 06/01 12:52