Notifications
Clear all

[Closed] Random strings

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 Replies

like this?

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

Yes! Works perfect. Thank you!