creating a random int list that accepts 2 duplicate values but not 3 or more

just as the title says. is this possible?

Make a list which contains every number twice. Either 1,2,3 … 1,2,3 … or 1,1, 2,2, 3,3 … will do. Then the rest is standard: shuffle it and use them in order from the front.

@strikeric11 Of course is…
For this you can use code like this:

 void checkRaps() {
		int check = 0, index = 0;
		List<int> a = new List<int> ();
		for (int i = 0; i < a.Count; i++) {
            index = a*;*
  •   		for (int j = 0; j < a.Count; j++) {*
    

if(index != j)
_ if (a == a [j]) {_
* check += 1;*
* }*
* }*
* if (check > 2) {*
_ Debug.Log ( a + " repeated more then twice");
* }
else { Debug.Log(“Accepted”); }
check = 0;
}
}*_