Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class PF {
  2. static double x1, x2;
  3.  
  4. public static void main(String... args){
  5. int n=10;
  6.  
  7. Random rand = new Random();
  8.  
  9. x1 = rand.nextDouble();
  10. double x2 = rand.nextDouble();
  11.  
  12. ArrayList<Double> wynikig5 = new ArrayList<>();
  13. ArrayList<Double> wynikig6 = new ArrayList<>();
  14.  
  15. for(int i=0;i<n;i++){
  16. double t = x1 + x2;
  17. x1 = x2;
  18. wynikig5.add(generatorG5(t));
  19. wynikig6.add(generatorG6(t));
  20. }
  21. }
  22.  
  23. static double generatorG5(double t) {
  24. double wynik = 0;
  25.  
  26.  
  27. if (t >= 4) wynik += 4;
  28.  
  29. x2 = t;
  30. wynik = 0.25 * t;
  31.  
  32. return wynik;
  33. }
  34.  
  35. static double generatorG6(double t) {
  36. double wynik = 0;
  37. x1 = x2;
  38. x2 = t - Math.floor(t);
  39. wynik = x2;
  40.  
  41. return wynik;
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement