If I have 10 objects and I want to assign a randomly selected texture from a pool of 10 textures to each object, how can I achieve this for a mesh object?
for(let i = 1; i <= 10 ; i++)
{ let loader = new THREE.TextureLoader();
let randomTextureIndex = Math.floor(Math.random() * 10) + 1;
let testMat = new THREE.MeshPhongMaterial({ map: loader.load('images/image' + randomTextureIndex) });
let testGeo = new THREE.SphereGeometry(50, 50, 50);
let testSphere = new THREE.Mesh(testGeo, testMat);
testSphere.position.set(distance, 100, 100);
scene.add(testSphere); }