malobar1003

Untitled

Sep 27th, 2021
992
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2. import time
  3.  
  4. m=32768
  5. a=23
  6. b=12345
  7.  
  8. def lin_rand_arr_flxd(seed,size):
  9.     if size==1:
  10.         return math.ceil(math.fmod(a*math.ceil(seed)+b,m))
  11.     r=[0 for i in range(size+1)]
  12.     r[0]=math.ceil(seed)
  13.     for i in range(1,size+1):
  14.         r[i]=math.ceil(math.fmod((a*r[i-1]+b),m))
  15.     return r[1:]
  16.  
  17. x, y = lin_rand_arr_flxd(time.time(), 40)[:20], lin_rand_arr_flxd(time.time(), 40)[20:]
  18. print(len(x), len(y))
  19.  
  20. for i in range(19):
  21.     j = i + 1
  22.     while j < 20:
  23.         k = (y[j] - y[i])/(x[j] - x[i])
  24.         b = -x[i]*k + y[i]
  25.         print('y = {:.2f}x{:+.2f}'.format(k, b))
  26.         j += 1
RAW Paste Data