Add a larger randomizer base

This commit is contained in:
Ivaylo Ivanov 2019-01-13 19:10:56 +01:00
parent 041fac9919
commit 2206728fa6

View File

@ -34,6 +34,7 @@
void swap(int *a, int *b); void swap(int *a, int *b);
void shuffle(int arr[], size_t size); void shuffle(int arr[], size_t size);
static unsigned int base_seed = 0;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if(argc < 2) { if(argc < 2) {
@ -189,8 +190,8 @@ void swap(int *a, int *b) {
* @return res * @return res
**/ **/
void shuffle(int arr[], size_t size) { void shuffle(int arr[], size_t size) {
base_seed = (base_seed + 1) % (__UINT64_MAX__); ///< Extreme values for the randomizer
srand(time(NULL)); ///< Set a random seed srand(base_seed); ///< Set a random seed
int j = 0; ///< Index that will be randomized later on int j = 0; ///< Index that will be randomized later on
for(int i = size - 1; i > 0; i--) { for(int i = size - 1; i > 0; i--) {