c++ 랜덤 코드!

 

https://learn.microsoft.com/ko-kr/cpp/standard-library/random?view=msvc-170 

 

<random>

자세한 정보:

learn.microsoft.com

 

#include <iostream>
#include <random>

using namespace std;

int main()
{
	random_device rd;
	mt19937 gen(rd());
	uniform_int_distribution<int> distribution(0, 10); // 0 ~ 10
	
	for (int i = 0; i < 10; ++i)
	{
		cout << distribution(gen) << endl;
	}
}

+ Recent posts