Created
April 22, 2010 07:12
-
-
Save matiit/374911 to your computer and use it in GitHub Desktop.
C++ generating random numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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