Created
February 28, 2013 09:48
-
-
Save ashleyholman/5055567 to your computer and use it in GitHub Desktop.
Here is the code to generate 1 million random integers for testing radixsort.c. Note that rand() will only output up to RAND_MAX which on my system is defined as 0x7fffffff, so I don't fully get the whole spectrum of possible 32 bit integers. I didn't bother fixing this, but perhaps 1 solution would be to generate two random 16-bit numbers and j…
This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
// Generate 1 million random 32-bit integers. | |
int main (int argc, char **argv) { | |
sranddev(); | |
int i; | |
for (i = 0; i < 1000000; i++) { | |
unsigned x = (unsigned)rand(); | |
printf("%i\n", x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment