Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 26, 2019 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/f87fcb91630ed415122ceb59172d9773 to your computer and use it in GitHub Desktop.
Save parzibyte/f87fcb91630ed415122ceb59172d9773 to your computer and use it in GitHub Desktop.
#include <stdio.h> // printf
#include <stdlib.h> // rand
#include <unistd.h> // getpid
// Función main
int main(){
// Hay que alimentar a rand, solamente una vez (seed rand)
srand(getpid());
// Ahora ya podemos llamar a la función
printf("Tengo un aleatorio: %d\n", rand());
printf("Tengo un aleatorio: %d\n", rand());
printf("Tengo un aleatorio: %d\n", rand());
printf("Tengo un aleatorio: %d\n", rand());
printf("Tengo un aleatorio: %d\n", rand());
printf("Tengo un aleatorio: %d\n", rand());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment