본문 바로가기

C..C++....

tr1 Random 사용하기



http://www.johndcook.com/cpp_TR1_random.html

간단하게 하면
#include <random>
#include <iostream>

void main()
{
    std::tr1::mt19937 eng;  // a core engine class
    std::tr1::uniform_int unif(1, 52);   
    for (int i = 0; i < 5; ++i)       
       std::cout << unif(eng) << std::endl;
}