Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pk.ssi.beans;
- import java.io.DataOutputStream;
- import java.io.FileOutputStream;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.util.Random;
- import org.apache.commons.lang3.RandomStringUtils; // Posrednik
- public class Plik {
- public static void main(String[] args) throws IOException {
- Random random = new Random();
- int s= random.nextInt() % 100 + 50;
- System.out.println(s);
- PrintWriter zapis = new PrintWriter("posrednik.txt");
- String imie, nazwisko;
- String telefon;
- int wiek;
- int biuro;
- int nr;
- for (int i=0;i<1500000;i++) {
- telefon = "";
- imie = RandomStringUtils.randomAlphabetic(5);
- nazwisko = RandomStringUtils.randomAlphabetic(5);
- String []plec = {"mezczyzna", "kobieta"};
- do {
- wiek = (random.nextInt() % 59);
- biuro = (random.nextInt() % 101);
- } while(wiek<0 || biuro<=0);
- wiek +=18;
- for(int j=0;j<3;j++)
- {
- do
- {
- nr = random.nextInt() % 1000;
- } while(nr<0 || nr < 100 || nr >=1000);
- if(j!=2) telefon +=nr+"-";
- else telefon+=nr;
- }
- zapis.println(imie +", " + nazwisko+", " +telefon+", " +biuro+ "," + wiek + "," +plec[wiek % 2] );
- }
- zapis.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement