Hi, my goal is to assign one out of 6 shaders to my selection of objects in away that each of them is randomly selected one out of those 6. I wrote those script, but I am not getting the desired result: they are all assigned the same randomly picked shader!
What am I missing and how would I solve that?
Here is my script:
string $sel[] = ls -sl;
int $count = 'size($sel)';
for ($i = 0; $i < $count; $i++)
{
$no = rand(6);
if ($no <= 1)
{
sets -e -forceElement Sparkle1SG;
}
else if ($no <= 2)
{
sets -e -forceElement Sparkle2SG;
}
else if ($no <= 3)
{
sets -e -forceElement Sparkle3SG;
}
else if ($no <= 4)
{
sets -e -forceElement Sparkle4SG;
}
else if ($no <= 5)
{
sets -e -forceElement Sparkle5SG;
}
else
{
sets -e -forceElement Sparkle6SG;
}
}
Your help is much appreciated.