daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest May 17th, 2018 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.BufferedWriter;
  2. import java.io.FileWriter;
  3. import java.io.IOException;
  4. import java.io.Writer;
  5. import java.util.Random;
  6.  
  7.  
  8.  
  9. public class zadanie3 {
  10.  
  11.     public static void main(String[] args) throws IOException {
  12.        
  13.         Writer writer = null;
  14.        
  15.         try {
  16.             double start = -5;
  17.             double end = 5;
  18.              writer =new BufferedWriter(new FileWriter("zadanie3.txt"));
  19.             double tablica[] = new double[5000];
  20.             for (int i = 0; i<tablica.length; i++) {
  21.                 double random = new Random().nextDouble();
  22.                 double result = start + (random * (end - start));
  23.                 tablica[i] = result;
  24.                 System.out.print(tablica[i] + " ");
  25.                 }
  26.             System.out.println();
  27.             for (int i = 0; i<tablica.length; i++) {
  28.                 char c = (char)(tablica[i]);
  29.                 writer.write(c);
  30.                 System.out.print(c+" ");
  31.             }
  32.            
  33.         }
  34.         finally {
  35.         writer.close();
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top