public static List<Long> getTracks(int distance){
//print(f'distance是{distance}')
distance += 20;
double v = Math.random()*400+200;
double t = 0.06;
List<Long> forwardTracks = new ArrayList<>();
int current = 0;
int a;
int mid = distance * 4 / 5;
while (current < distance){
if (current < mid){
a = 40;
}else{
a = -10;
}
double s = v * t + 0.5 * a * (Math.pow(t,2));
v = v + a * t;
current += s;
forwardTracks.add(Math.round(s));
}
return forwardTracks;
}
這是公司原有的代碼,產生的作用是 給定一個int型別的橫向坐標,然后生成 一個個 比這個橫坐標小的 線段 長度。用于爬蟲 滑動 淘寶等滑塊驗證,但是我看不太懂 這樣寫的作用,望有大佬能給個思路。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/252852.html
標籤:Java相關
下一篇:poi匯出Excel報錯
