sorts array a0 n1 using bogo sort to check if array is sorted or not to generate permuatation of the array driver code to test above sorts array a 0 n 1 using bogo sort to check if array is sorted or not to generate permuatation of the array driver code to test above
import random




def bogo_sort(a):
    n = len(a)
    while (is_sorted(a) == False):
        shuffle(a)




def is_sorted(a):
    n = len(a)
    for i in range(0, n - 1):
        if (a[i] > a[i + 1]):
            return False
    return True




def shuffle(a):
    n = len(a)
    for i in range(0, n):
        r = random.randint(0, n - 1)
        a[i], a[r] = a[r], a[i]



a = [3, 2, 4, 1, 0, 5]
bogo_sort(a)
print("Sorted array :")
for i in range(len(a)):
    print("%d" % a[i]),