그러다 우연히 괜찮은 문서를 하나 찾았다. (이것)
간단한 설명, 입력, 출격, 알고리즘 등 잘 정리되어 있는데다 필요한 함수만 골라서 쓸수도 있다.. ㅎㅎ
사용법도 간단한데...
#include
#include "Random.h" // the header file
void main( void )
{
Random rv; // a random variate (using the UNIX process ID as seed)
for ( int i = 0; i < 1000; i++ )
cout << rv.normal() // the normal distribution (using default parameters)
<< endl;
}
이렇게만 하면 X ~ N(0,1) 을 구할수 있다.
댓글 없음:
댓글 쓰기