I have a 3 variables and i want the 3 of them to have unique integers with a maximum integer value of 2. Example var1 =2 var2 =0 var3 =1. I can do this but not efficient.

```
var1 = Random.Range(0,3)
var2 = Random.Range(0,3)
while (var1== var2){
var2 = Random.Range(0,3)
}
var3 = Random.Range(0,3)
while (var3== var2 | var3== var1){
var3 = Random.Range(0,3)
}
```

How can i do this efficiently

Hey man! , not sure if this would work but could you keep an array of your numbers and use the index as the random part. Then remove that index so the value can’t appear twice.

```
var values = [0,1,2];
int setRandomNumber(){
int randomIndex = Random.Range(0,values.length);
int randomValue = values[randomIndex];
values.RemoveAt(randomIndex);
return randomValue;
}
var1 = setRandomNumber();
var2 = setRandomNumber();
var3 = setRandomNumber();
```

The only thing is I’m not sure how efficient this is I’m afraid, hope this helped buddy