Hi,

I have the need to randomize the order (shuffle) of very large

datasets. The way I devise, randonly sampling with elimination, is

not very efficient. Is there a better way, using octave's matrix

manipulation?

My way:

nm = num = rows(data);

for i=1:num

rn = ceil(rand * nm--);

new_data(i,:) = data(rn,:);

data(rn,:) = [];

endfor

Better way: perhaps creating a vector of unique indexes? but how to

do this?

idx = 1:rows(data);

now shuffle idx

new_data = data(idx,:)

Of course, this it is the same problem in one dimension...

Thanks,

Joao

--

Joao Cardoso, INESC | e-mail:

[hidden email]
R. Jose Falcao 110 | tel: + 351 2 2094345

4050 Porto, Portugal | fax: + 351 2 2008487