Random Positions without Repeating

Hi everyone, i want my objects to spawn at random positions without repeating the same position. For example there are 7 locations and and i basically want them to shuffle.

I tweaked the Spawner script that is used in the 2D Platformer demo to have random spawns. It is below. Any idea how can to avoid repeating?

using UnityEngine;
using System.Collections;


public class SpawnerMY : MonoBehaviour
{
	public float spawnTime = 5f;		// The amount of time between each spawn.
	public float spawnDelay = 3f;		// The amount of time before spawning starts.
	public GameObject[] enemies;		// Array of enemy prefabs.
	public Transform[] teleport;

	void Start ()
	{
		// Start calling the Spawn function repeatedly after a delay .
		InvokeRepeating("Spawn", spawnDelay, spawnTime);

	}



	void Spawn ()
	{

	
		// Instantiate a random enemy.
		int enemyIndex = Random.Range(0, enemies.Length);
		int tele_num = Random.Range(0,7);
		Instantiate(enemies[enemyIndex], teleport[tele_num].position, teleport[tele_num].rotation);

		// Play the spawning effect from all of the particle systems.
		foreach(ParticleSystem p in GetComponentsInChildren<ParticleSystem>())
		{
			p.Play();
		}
	}
}

[SerializeField] private int range = 20; // Hom many items you want, will show in Inspector
Listlist = new List();
void Start()
{
FillList();
}

void FillList()
{
   for(int i = 0; i < range; i++)
   {
      list.Add(i);
   }
}

int GetNonRepeatRandom()
{
    if(list.Count == 0){
        return -1; // Maybe you want to refill
    }
    int rand = Random.Range(0, list.Count);
    int value = list[rand];
    list.RemoveAt(rand);
    return value;
}

One possible solution would be to use a List for the positions to place them.
http://answers.unity3d.com/questions/284054/lists-c.html

You can populate the list when ready to use it, then remove the specific entries from it as you use them. That way, you could randomly choose a position from the List and never have to worry about repeating.

Don’t Take An Effort, Do Easier in Unity C#

//Random.Range Position But Not Repeat

{
public GameObject spawnEnmy;

	public List<Transform> spnPosns = new List<Transform>();

	//Queue<Transform> spnPnts = new Queue<Transform>();

	float spnIn, spwnOut;

	private void Awake() => spnIn = spnPosns.Count;

	private void Start()
	{
		while (spwnOut <= (int)spnIn)
		{
			if (spnPosns.Count >= 0)
			{
				var rdmNxt = spnPosns[Random.Range(0, spnPosns.Count)];
				spwnIng(spawnEnmy, rdmNxt);
				spnPosns.Remove(rdmNxt);
			}

			spwnOut++;
			Debug.Log(spnPosns.Count);
		}
	}

	public static void spwnIng(GameObject spwnObj, Transform spwnPos) => Instantiate(spwnObj, spwnPos.position, Quaternion.identity);
}

When You Run on Unity Do Work fine But in the Last “ArgumentOutOfRangeException” Don’t penic Because Index List<> Size will Zero, This Not A Coding this are Debug Mistake Because Debug Skip if() condion in this, Anyway Because code in Start() So Not Wrong with Them