Skip to content

Instantly share code, notes, and snippets.

@matiit
Created April 22, 2010 07:12
Show Gist options
  • Save matiit/374911 to your computer and use it in GitHub Desktop.
Save matiit/374911 to your computer and use it in GitHub Desktop.
C++ generating random numbers
#include <ctime>
#include <cstdlib>
// W funkcji głównej trzeba zainicjalizowac generator liczb losowych
srand(time(NULL));
// widac losowanie
void wypeln_los(int *tab, int n, int min, int max){
for (int i=0;i<n;i++){
tab[i] = rand()%(max-min+1)+min;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment