Random strings


#1

Hi,

Im trying to do create a function that replace material from a defined selection inside a material library
similar to this
red = random “grey” “black” “blue”
The random function works great when using integers m[i] = matLib[index] -> matlib[random 1 10] but when replacing the integers with strings it doesnt work. Is there a smart way to randomize the strings?

    index = "plastic.grey"
    for m in material do(		
	for i = 1 to m.numsubs do(
		m[i] = matLib[index] 
	)
    )

#2

like this?

random_mtl = mtl_lib[ strings_array[ random 1 strings_array.Count ] ]

#3

Yes! Works perfect. Thank you!