hi i really need some help with my procedural generation

Godot Version

3.4

hi I’m quite new to coding and atm I’m following a tutorial just to learn the basics, but when my game procedural spawns the corridor to the next room the floor tiles work fine when its any length other than 4 tiles long, when its 4 tiles long it doesn’t spawn the first floor tile and I’ve been stumped on this for hours

if you have any help that would be appreciated thank you

this is the code that generates everything

extends Navigation2D

const SPAWN_ROOMS: Array = [preload(“res://scenes/rooms/spawnroom.tscn”)]
const INTERMEDIATE_ROOMS: Array = [preload(“res://scenes/rooms/room0.tscn”), preload(“res://scenes/rooms/room1.tscn”), preload(“res://scenes/rooms/room2.tscn”)]
const END_ROOMS: Array = [preload(“res://scenes/rooms/endroom.tscn”)]

const TILE_SIZE: int = 16
const FLOOR_TILE_INDEX: int = 66
const RIGHT_WALL_TILE_INDEX: int = 9
const LEFT_WALL_TILE_INDEX: int = 10

export(int) var num_levels: int = 5

onready var player: KinematicBody2D = get_parent().get_node(“player”)

func _ready() → void:
_spawn_rooms()

func _spawn_rooms() → void:
var previous_room: Node2D

for i in num_levels:
	var room: Node2D
	
	if i == 0:
		room = SPAWN_ROOMS[randi() % SPAWN_ROOMS.size()].instance()
		player.position = room.get_node("PlayerSpawnPos").position
	else:
		if i == num_levels - 1:
			room = END_ROOMS[randi() % END_ROOMS.size()].instance()
		else:
			room = INTERMEDIATE_ROOMS[randi() % INTERMEDIATE_ROOMS.size()].instance()
		
		var previous_room_tilemap: TileMap = previous_room.get_node("TileMap")
		var previous_room_door: StaticBody2D = previous_room.get_node("Doors/Door")
		var exit_tile_pos: Vector2 = previous_room_tilemap.world_to_map(previous_room_door.position) + Vector2.UP * 2 
		
		var corridor_hight: int = randi() % 4 + 2
		for y in corridor_hight:
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(-2, -y), LEFT_WALL_TILE_INDEX)
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(-1, -y), FLOOR_TILE_INDEX)
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(0, -y), FLOOR_TILE_INDEX)
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(-1, y), FLOOR_TILE_INDEX)
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(0, y), FLOOR_TILE_INDEX)
			previous_room_tilemap.set_cellv(exit_tile_pos + Vector2(1, -y), RIGHT_WALL_TILE_INDEX)
		
		var room_tilemap: TileMap = room.get_node("TileMap")
		room.position = previous_room_door.global_position + Vector2.UP * room_tilemap.get_used_rect().size.y * TILE_SIZE + Vector2.UP * (1 + corridor_hight) * TILE_SIZE + Vector2.LEFT * room_tilemap.world_to_map(room.get_node("Entrance/Position2D").position).x * TILE_SIZE + Vector2.LEFT
	
	add_child(room)
	previous_room = room

I think i need more information to help you here. So it doesnt set the first tile when corridor_height equals 4 and only 4? Is it just one tile or a row of tiles?