헤더파일 :

#include<iostream> // rand 함수 라이브러리
#include<time.h> //타이머 라이브러리 

사용되는 함수 

srand(time(NULL)); //시간 seed를 뿌림
rand();//시간 시드를 받은 랜덤 변수 함수 

ex)

#include<iostream>
#include<time.h>

int main(){

srand(time(NULL))
cout<<rand()%100<<endl; // 0~100까지 랜덤 변수

system("pause");
return 0;


}

'프로그래밍언어 > C++' 카테고리의 다른 글

마우스 좌표값 얻어오기  (0) 2019.09.27
Save data Text file  (0) 2019.09.20
OBB(Object Oriented Bounding Box) Collision  (2) 2019.09.10
Translation Matrix  (0) 2019.09.04
C++ <AABB Collision>  (0) 2019.08.19

+ Recent posts