rename your 8 objects to use the same stem and suffix that I have listed below, or change those strings to what you want. The suffix is important because you are using a * to match objects, if you dont have a suffix it will match the shape nodes as well and you don't want that. so make sure it's stem_ID_suffix!
Code:
string $stem = "dupes_";
string $suffix= "_GEO";
string $obj = "pPlane1";
//get a list of our objects, note that this is an array now
string $dupeSel[] = `ls ($stem + "*" + $suffix)`;
int $numbVerts[] = `polyEvaluate -v $obj`;
int $i = 0;
for($i; $i < $numbVerts[0]; $i++)
{
//pick an object to duplicate, by selecting a random int between 0 and the size of the array, Add one to bring it inline with our object IDs that start at 1
int $dupeInt = rand(0, size($dupeSel));
$dupeInt++;
float $pos[] = `xform -q -ws -t ($obj + ".vtx["+$i+"]")`;
//build up a string of which object to duplicate
string $new[] = `duplicate -rr ($stem + $dupeInt + $suffix)`;
setAttr ($new[0] + ".translateX") $pos[0];
setAttr ($new[0] + ".translateY") $pos[1];
setAttr ($new[0] + ".translateZ") $pos[2];
}
Alan
Technical Director - Framestore
Currently working on: Your Highness
IMDB