Spawn system not working correctly

I try to spawn one or two obstacle at the same time given the position rightpos, midpos, and leftpos
but i keep getting the spawn position to only rightpos and midpos.

void Start () { 
	rightpos = new Vector2(2f,6f);
	midpos = new Vector2 (0f,6f);
	leftpos = new Vector2 (-2f, 6f);
}

// Update is called once per frame
void Update () {
	if (spawn_activate == true) {
		number_of_spawn = Random.Range (1, 2);
		spawn_activate = false;
	}
	if (number_of_spawn > 0) {
		spawnposition = Random.Range (0, 2);
		if (spawnposition == 0) {
			Instantiate(obstacle,rightpos,Quaternion.identity);
		}
		if(spawnposition == 1) {
			Instantiate(obstacle,midpos,Quaternion.identity);
		}
		if(spawnposition == 2) {
			Instantiate(obstacle,leftpos,Quaternion.identity);
		}
		number_of_spawn -= 1;
	}
}

Random.Range(int min, int max), is exclusive of the max value, i.e. Random.Range(0,2) will only return 0 or 1, and never 2. You want to use Random.Range(0,3) , which will return 0,1, or 2.

Also, change Random.Range (1, 2) (which only ever returns 1); to Random.Range (1, 3), which will return 1 or 2.