Re: [問題] 隨機亂數rand()的問題

看板C_and_CPP (C/C++)作者 (s8752199)時間16年前 (2009/06/01 11:11), 編輯推噓4(401)
留言5則, 3人參與, 最新討論串4/4 (看更多)
請問有人知道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

06/01 11:20, , 1F
用algo生出來的都是pseudo random numbers
06/01 11:20, 1F

06/01 11:56, , 2F
我去看了一下, 它不是使用演算法計算而是用檢測大氣noise
06/01 11:56, 2F

06/01 11:56, , 3F
的方法, 感覺是有可能產生 true random number
06/01 11:56, 3F

06/01 11:58, , 4F
大氣雜訊就不能重現 除非時光機器了 XD
06/01 11:58, 4F

06/01 12:52, , 5F
當然不能重現 能推得出來的都不是真正隨機數
06/01 12:52, 5F
文章代碼(AID): #1A8qRZmC (C_and_CPP)
文章代碼(AID): #1A8qRZmC (C_and_CPP)