emzei

  • Tag
  • Medialog
  • Location
  • Guestbook
  • Admin
  • Write

NOWS/Language C, C++ 2

gettimeofday()를 이용한 시간 측정하기

참고 출처 : - https://stackoverflow.com/questions/5248915/execution-time-of-c-program/5249028 - https://levelup.gitconnected.com/8-ways-to-measure-execution-time-in-c-c-48634458d0f9 #include struct timeval tv1, tv2; gettimeofday(&tv1, NULL); /* stuff to do! */ gettimeofday(&tv2, NULL); printf ("Total time = %f seconds\n", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 + (double) (tv2.tv_sec - tv1.tv..

NOWS/Language C, C++ 2021.06.11

난수 생성 / rand()

rand()는 0 부터 RAND_MAX 사이의 난수를 생성 rand()만 사용하는 경우, 생성되는 난수의 값과 순서가 항상 동일함 #include#include { ...int val = rand(); ... } srand()를 통하여 seed 값을 설정하여 시시각각 변하도록 할 수 있음.seed값을 time(null)로 설정함으로써, 초 단위로 난수 생성에 변화를 줄 수 있음. #include#include #include { ...int val = rand(time(NULL)); ... }

NOWS/Language C, C++ 2016.05.16
이전
1
다음
더보기
  • 분류 전체보기 (221)
    • Daily (7)
    • Multi-V (8)
    • NOWS (53)
      • ULK (3)
      • SICP (5)
      • Perl (7)
      • Logic Circuit (0)
      • Automata (2)
      • Eng.study (4)
      • C O D E (0)
      • Language C, C++ (2)
      • Linear Algebra (0)
      • Statistics (0)
      • Data Communication (0)
      • MEMO (19)
      • Security (10)
      • Operating Systems (1)
    • Computers (153)
      • Adv. Linux System Pr.. (9)
      • Algorithm (10)
      • Android (10)
      • Computer Architectur.. (4)
      • Data Structure (13)
      • Databases (12)
      • Language python (23)
      • Linux System Program.. (16)
      • Language java (17)
      • Programming Language (9)
      • Raspberry-pi (5)
      • SW Engineering (9)
      • Xen (6)
      • (한빛) 컴퓨터개론 (10)

Tag

Android, Tree, domu, list, XEN, xen 4.4, interface, polymorphism, inheritance, GUI, 자료구조, xen guest installation, Data Structure, string, DICTIONARY, Python, xen compile, protected, layout, java,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

  • emzei[엠제이]

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바