Created
March 25, 2018 16:15
-
-
Save Dimanaux/0840ff6c830915bb8cb3b1267a136ae0 to your computer and use it in GitHub Desktop.
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
| import java.io.File; | |
| import java.io.FileWriter; | |
| import java.io.IOException; | |
| import java.util.Arrays; | |
| import java.util.Random; | |
| public class InputGenerator { | |
| public static void main(String[] args) throws IOException { | |
| Random random = new Random(); | |
| int[] fileSizes = new int[99]; | |
| for (int i = 0; i < fileSizes.length; i++) { | |
| fileSizes[i] = random.nextInt(10_000) + 100; | |
| } | |
| Arrays.sort(fileSizes); | |
| FileWriter fileWriter; | |
| for (int i = 0; i < fileSizes.length; i++) { | |
| File file = new File("./res/file" + i + ".txt"); | |
| file.createNewFile(); | |
| fileWriter = new FileWriter(file); | |
| for (int j = 0; j < fileSizes[i]; j++) { | |
| fileWriter.write(String.valueOf(random.nextInt()) + " "); | |
| } | |
| fileWriter.close(); | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this saved my life