how to randomly generate number with out using a number twice

I am trying to randomly Generate number 0-9 without using a number twice Anyone have any idea how to do so heres the code i know why this code will not work but is there a algorithm that i can use or somthing :

public void GenerateRandomColor ()
for(int i = 0;i <= 16;i++)
int randomColorIndex = Random.Range(0,8);
colorPanels*.GetComponent().material.color = colors[randomColorIndex];*
colorPanels .GetComponent ().material.SetColor(“_EmissionColor”,colors[randomColorIndex]);
* tempColor = colors[randomColorIndex];*
* }*
* }*

I think it’s easier to fill a list with numbers and randomly pick one, then remove it.

Its ok i figured it out thanks for helping i used the Fisher-Yates shuffle algorithm that seem to do the trick.

heres a link to the algorithm : C# Fisher Yates Shuffle - Dot Net Perls