Randomize order of an array?
Posted by Mike Myerburg on Feb 27, 2009; 9:28pm
URL: http://imagej.273.s1.nabble.com/Randomize-order-of-an-array-tp3693530.html
Hi-
I use a modified version of the BatchProcessFolders Macro to analyze all
the images in a folder. In order to be as objective as possible, I
would like to randomize the order that the images are processed (I have
already blanked out the filename, so I cant cheat that way). Here is a
snippet of the macro that call sends each file to processFile-
function processFiles(dir) {
list = getFileList(dir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/"))
processFiles(""+dir+list[i]);
else {
showProgress(n++, count);
path = dir+list[i];
processFile(path);
}
}
}
The array list then would contain the ordered list of files. Is there a
way to randomize the order of these file in the array using the macro
language?
Thanks for the help, Mike