Advertisement
Guest User

neighbor7

a guest
Sep 19th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.29 KB | None | 0 0
  1. function y=neighbor7(x)
  2. % Troca um membro com seu proximo
  3.     index = randi(length(x));
  4.     aux = x(index);
  5.     y = x;
  6.     if(index < length(x))
  7.         y(index) = x(index+1);
  8.         y(index+1) = aux;
  9.     else
  10.         y(index) = x(index-1);
  11.         y(index-1) = aux;
  12.     end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement