wolffd@0: function [i,j] = pick(ndx) wolffd@0: % PICK Pick an entry at random from a vector wolffd@0: % function [i,j] = pick(ndx) wolffd@0: % wolffd@0: % i = ndx(j) for j ~ U(1:length(ndx)) wolffd@0: wolffd@0: dist = normalize(ones(1,length(ndx))); wolffd@0: j = sample_discrete(dist); wolffd@0: i = ndx(j);