Skip to content

Instantly share code, notes, and snippets.

@rysk-t
Created September 19, 2017 04:32
Show Gist options
  • Save rysk-t/c832dd7da1d35e5b12960fc09b29ff8e to your computer and use it in GitHub Desktop.
Save rysk-t/c832dd7da1d35e5b12960fc09b29ff8e to your computer and use it in GitHub Desktop.
function shuffled_idx = ratio_shuffle(len, ratio)
% hidx = 1:4:length(tune(:));
% hidxs = hidx(randperm(length(hidx)));
% tune_h = tune;
% tune_h(hidx) = tune(hidxs);
shuffled_idx = 1:len;
soi = randperm(len);
soi_s = soi(1:floor(len*ratio));
soi_s = soi_s(randperm(length(soi_s)));
shuffled_idx(soi(1:floor(len*ratio))) = soi_s;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment