Advertisement
Guest User

Wtf

a guest
Jan 24th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let arrNum = [],
  2.     arr = [],
  3.     n = Math.round(Math.random() * 10);
  4.     n % 2 === 1 ? n += 1: n = n;
  5.  
  6. for(let i = 0; i < n; i++) {
  7.     arrNum[i] = i;
  8.     let a = Math.round(Math.random() * 10);
  9.     a = -a;
  10.     arr[i] = a;
  11. };
  12.  
  13. console.log(arr);
  14. console.log(arrNum);
  15.  
  16. n = n / 2;
  17. console.log(n);
  18.  
  19. for(let i = 0; i < n; i++) {
  20.     let b = Math.round(Math.random() * n),
  21.         c = Math.round(Math.random() * 1000);
  22.     arr[b] = c;
  23.     arrNum = arrNum.filter(item => item != b);
  24. };
  25.  
  26. console.log(arr);
  27. console.log(arrNum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement