text: printf("sorted result:"); for (int i = 0; i < size; i++) {
  printf(" %d", input[i]);
  }
  printf("\n");
  return 0;
  }
  Python
  Here is the above pseudocode rewritten in Python 3:
  import random
  # bogosort
  # what happens is there is a random array that is generated by the last function
  # the first function checks whether the array is sorted or not
  # the second function repeatedly shuffles the array for as long as it remains unsorted
  # and that's it
  # happy coding =>
  # this function checks whether or not the array is sorted
  def is_sorted(random_array):
  for i in range(1, len(random_array)):
  if random_array[i] < random_array[i - 1]:
  return False
  return True
  # this function repeatedly shuffles the elements of the array until they are sorted
  def bogo_sort(random_array):
  while not is_sorted(random_array):
  random.shuffle(random_array)
  return random_array
  # this function generates an array with randomly chosen integer values
  def generate_random_array(size, min_val, max_val):
  return [random.randint(min_val, max_val) for _ in range(size)]
  # the size, minimum value and maximum value of the randomly generated array
  size = 10
  min_val = 1
  max_val = 100
  random_array = generate_random_array(size, min_val, max_val)
  print("Unsorted array:", random_array)
  sorted_arr = bogo_sort(random_array)
  print("Sorted array:", sorted_arr)
  This code assumes that  is a simple, mutable, array-like data structure—like Python's built-in —whose elements can be compared without issue.