Ai User Data String
Here is a simple MEL script that creates a texture path with a random file number as a shape attribute. Using the AiUserDataString, one aiStandard shader can assign random textures across multiple objects.
In this example, I have a folder on the desktop containing 61 icons. The script will loop through the selected objects and create a custom string attribute with a path to one of the icons in the folder. The AiUserDataString node is plugged into the file texture path on a standard Maya file node. When Arnold renders the scene, the texture call will look up the shape’s custom attribute to determine which texture to use. Here is more information on Arnold’s UserData nodes.