Number Generator
This program generates a file with a specified number of random integers, then sorts the random numbers, and outputs the random numbers to another file.
Usage
This program takes the following command-line parameters:
- Flag to generate new random numbers or to use an existing file.
- When we use
-g
to generate a new random file we enter:- The number of integers to generate.
- The name of the file that contains random values
- The name of the file that contains sorted values
- When we use
-e
to use an existing file we enter:- The name of the file that contains random values
- The name of the file that contains sorted values
For example, to generate one million values, save the random values to "oneMillionRandom.txt" and the sorted values to "oneMillionSorted.txt", we use the following parameters:
-g 1000000 oneMillionRandom.txt oneMillionSorted.txt
If there is an existing file "tenThousandRandom.txt" we can use, and we wish to write sorted output to "tenThousandSorted.txt", we can use the following parameters:
-e tenThousandRandom.txt tenThousandSorted.txt
Assumptions
To simplify this program, we make the following assumptions:
- The random numbers to be generated are signed 32-bit integers
- Input and output should be to a line-delimited plain-text file