Created
May 8, 2019 12:54
-
-
Save koenkarsten/55f5113fc5a9829e74f16918d420cb1f to your computer and use it in GitHub Desktop.
TestDataGenerator
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
import java.io.BufferedWriter; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
public class TestDataGenerator { | |
public static void main(String[] args) { | |
int maxSize = 100; | |
int counter = 0; | |
try { | |
FileWriter fw = new FileWriter("testdata.txt", true); | |
BufferedWriter bw = new BufferedWriter(fw); | |
PrintWriter out = new PrintWriter(bw); | |
for (int i = 0; i < 5; i++) { | |
out.print("Data: "); | |
for (int j = 0; j < maxSize; j++) { | |
long n = (int) (java.lang.Math.random() * 99); | |
out.print(" " + n); | |
counter = counter + 1; | |
} | |
out.println(""); | |
maxSize = maxSize * 10; | |
} | |
out.flush(); | |
bw.flush(); | |
fw.flush(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
System.out.println("Numbers generated: " + counter); | |
System.exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment