Skip to content

Instantly share code, notes, and snippets.

@otaks
Created July 29, 2016 11:54
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 otaks/1a6c519f693f3fe2884e318e8fe1bfae to your computer and use it in GitHub Desktop.
Save otaks/1a6c519f693f3fe2884e318e8fe1bfae to your computer and use it in GitHub Desktop.
random
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main() {
int v[ 100 ] = { 0 };
srand( time( NULL ) );
for( int j = 0; j<20000; j++){
v[ rand() % 50 + rand() % 51 ]++;
}
for( int i = 0; i<100; i++ ) {
printf("%d\n", v[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment