input: Write a function to perform monkey sort (BogoSort) on a given array.
  assert monkey_sort([7, 5, 4, 9, 6, 2, 1, 8]) == sorted([7, 5, 4, 9, 6, 2, 1, 8])
  assert monkey_sort([3, 1, 2]) == sorted([3, 1, 2])
  assert monkey_sort([5, 4, 3, 2, 1]) == sorted([5, 4, 3, 2, 1])
output: import random
  
  def monkey_sort(arr):
      def is_sorted(arr):
          for i in range(len(arr) - 1):
              if arr[i] > arr[i + 1]:
                  return False
          return True
      
      while not is_sorted(arr):
          random.shuffle(arr)
      
      return arr