책/윤성우 열혈 C 프로그래밍
c언어 난수생성
안양사람
2020. 9. 19. 18:07
728x90
SMALL
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i;
printf("난수의 범위: 0부터 %d까지 \n", RAND_MAX);
srand((int)time(NULL)); // 현재시간을 이용해서 씨드 설정
for(i=0; i<5; i++)
printf("난수 출력: %d \n", rand());
return 0;
}
728x90
LIST