Random generating answers

I’ve been trying to get my hands onto this, and got stuck. I know how to get random texture from an existing array

renderer.material.mainTexture = myTextures[Random.Range(0, myTextures.Length)];

but what I need is that the exact array is divided into three parts.

For example, the array is named myAnswers, and I have three cubes. What I want is the textures to be applied on the three cubes, BUT the answers are three different answers everytime, so that none appears twice.

A little clearer, for example I have a question, 5 X 4 =, and now three answers appear :
19, 20, or 21 for example, if it’s possible so that it’s more realistic, if they were 8, 20, 56 it would be pretty obvious.

Somehow, the answers need to be grouped, and I think of maybe textures change and are applied on different cubes, or either they are on one cube but the cube is swapped.
Oh, and the language doesn’t matter.

I hope I explained well, please note if there is something unclear.

Thanks.

Just use a List where you can remove used items so they don't come up twice:

// C#
// Your public arrays
public GameObject[] myAnswers;
public Texture2D[] myTextures;

// Use this to assign the textures
List<Texture2D> answerTextures = new List<Texture2D> (myTextures);
foreach(GameObject go in myAnswers)
{
    if (answerTextures.Count > 0)
    {
        int textureIndex = Random.Range(0, answerTextures.Count); // Select a random texture ot of the remaining textures
        go.renderer.material.mainTexture = answerTextures[textureIndex];
        answerTextures.RemoveAt(textureIndex); // remove this texture from the list
    }
}

edit

The same in UnityScript ;)

// UnityScript (Javascript)
// Your public arrays
var myAnswers : GameObject[];
var myTextures : Texture2D[];

// Use this to assign the textures
var answerTextures = new List.<Texture2D>(myTextures);
for(var go : GameObject in myAnswers)
{
    if (answerTextures.Count > 0)
    {
        var textureIndex = Random.Range(0, answerTextures.Count); // Select a random texture ot of the remaining textures
        go.renderer.material.mainTexture = answerTextures[textureIndex];
        answerTextures.RemoveAt(textureIndex); // remove this texture from the list
    }
}

second edit

Well, i've actually pasted the code in a script and yes, there was a typo from copy&pasting the RandomRange line ;) I've fixed it.

Also you might have to add

using System.Collections.Generic;

at the top of your C# script or

import System.Collections.Generic;

in your JS script to be able to use the generic classes.

However it should just explain how you could do it. I can't (and will not) write a whole script that fits into your project since i don't even know anything about your project except the bit of information in your question. You should try to understand it and not just C&P it and complain it doesn't work. It's your project.