input: from typing import List
  
  def generate_random_array(dimension: int) -> List[List[int]]:
      """ Generates a square array (dimension x dimension) filled with random integers ranging from 1 to 5.
      >>> generate_random_array(2)
      [[1, 4], [2, 3]]
      >>> generate_random_array(3)
      [[3, 1, 4], [2, 5, 2], [1, 3, 4]]
      """
output:     import random
      return [[random.randint(1, 5) for _ in range(dimension)] for _ in range(dimension)]