Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedWriter;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.util.Random;
- class Program4
- {
- public static void main(String[] args)
- {
- String ch;
- String Filename = "/home/lab/po2/9/Desktop";
- Random rand = new Random();
- String alphabet = "qwertyuiopasdfghjklzxcvbnm1234567890~!@#$%^&*()_+<>?:|{}";
- for (int i=0; i<1000; i++)
- {
- BufferedWriter bw = null;
- FileWriter fw = null;
- try
- {
- ch=String.valueOf(alphabet.charAt(rand.nextInt(alphabet.length())));
- fw = new FileWriter(Filename);
- bw = new BufferedWriter(fw);
- bw.write(ch);
- }
- catch (IOException e)
- {
- System.out.println("Blad zapisu!");
- System.exit(0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement