C++ 11에서는 mt19937과 같은 의사 난수 생성기를 사용하거나 사용하지 않고 std::random_device
을 사용하여 숫자를 생성 할 수 있습니다.std :: random_device와 pRNG를 사용하는 것의 차이점은 무엇입니까? 표준 : : mt19937과없이?
#include <random>
#include <iostream>
int main() {
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> dist(1, 10);
for (int i=0; i<16; ++i)
std::cout << dist(rd) << "\t" << dist(mt) << "\n";
}
http://en.cppreference.com/w/cpp/numeric/random/random_device –