[C] 난수 생성

#include <stdio.h>
#include <time.h>

srand((unsigned int)time(NULL)); // 이 코드는 함수에 한번만 써주면 됨

num = rand() % 100 ; // 0~99의 난수를 생성

num = rand() % 10; // 0~9의 난수를 생성

댓글

이 블로그의 인기 게시물

WOL(Wake On Lan) 기능 사용

[NSIS] 사설 인증서 등록