Skip to content

Instantly share code, notes, and snippets.

@willk
Created October 3, 2014 05:08
Show Gist options
  • Save willk/893fab0b9818cdd05079 to your computer and use it in GitHub Desktop.
Save willk/893fab0b9818cdd05079 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
srand(time(0)); //use current time as seed for random generator
int random_variable = rand();
printf("Random value on [0,%d]: %d\n", RAND_MAX, random_variable);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment