package cha;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
public class aaaa {
public static void main(String[] args) {
Random rand = new Random();
try (FileOutputStream fos = new FileOutputStream("张.txt")){
for (int i = 0; i < 5000; i++) {
fos.write(randStr(rand.nextInt(3,15)).concat("\t\n").getBytes());
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static String randStr(int n) {
Random rand = new Random();
String letter = "abcdefghijklmnopqrstuvwsyz";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
StringBuilder sb1 = new StringBuilder();
int len = rand.nextInt(2,10)
for (int j = 0; j < len; j++) {
sb1.append(letter.charAt(rand.nextInt(letter.length())));
}
sb1.append(" ");
String ts = new String(sb1);
if (i ==0 ){
ts = ts.substring(0,1).toUpperCase().concat(ts.substring(1));
}else if (i == n-1){
ts = ts.substring(0,ts.length()-1)+"!.?".charAt(rand.nextInt(3));
}
sb.append(ts);
}
return sb.toString() ;
}
}