Tutorialspoint

srand() in C language

#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int main() {
   srand(time(NULL));
   printf("%d\n", rand());
   srand(12);
   printf("%d", rand());
   return 0;
}

Advertisements
Loading...