- 375 名前:デフォルトの名無しさん [2012/01/27(金) 18:35:57.55 ]
- randomデバイスの挙動が意味不明なので、おしえてください。
intに入る非負だと思っていたのですが。 $ more rnd.cpp #include <iostream> #include <random> using namespace std; void echo(int val) { cout << "why? " << val << endl; } int main() { static random_device rnd; for (int i=0; i<10; ++i) { echo(rnd()); cout << rnd() << endl; } } $ g++-mp-4.6 -std=c++0x rnd.cpp $ ./a.out why? -1796924150 3042913710 why? -314325772 2069611482 why? 1357648257 1265153896 ...
|

|