Skip to content

Instantly share code, notes, and snippets.

@rsnemmen
Created June 9, 2017 03:37
Show Gist options
  • Select an option

  • Save rsnemmen/a46fcd4d329087b22006bf8c40069ad2 to your computer and use it in GitHub Desktop.

Select an option

Save rsnemmen/a46fcd4d329087b22006bf8c40069ad2 to your computer and use it in GitHub Desktop.
Generates 1000 pseudo random numbers (integers)
/*
Generates 1000 pseudo random numbers (integers).
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
int i, imax=1000;
float ran;
srand(time(NULL)); // initialize pseudo-random number generator
for (i = 0; i < imax; i++){
ran = rand() % 1000;
printf("%f \n", ran);
}
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment