#SmileBASIC, 104 bytes DEF B A DIM T[LEN(A)]FOR I=0TO LEN(A)-1T[I]=RNDF()IF I&&A[I-1]>A[I]GOTO@B NEXT RETURN@B SORT T,A B A END Explanation: DEF BOGOSORT ARRAY[] 'create function DIM TEMP[LEN(ARRAY)] 'create array used for scrambling FOR I=0 TO LEN(ARRAY)-1 'loop through array TEMP[I]=RNDF() 'fill TEMP with random numbers IF I && ARRAY[I-1]>ARRAY[I] GOTO @BREAK 'if array is not sorted, exit the loop (skip check if I is 0) NEXT RETURN @BREAK SORT TEMP,ARRAY 'sort A using the random array B A 'call the function again (much shorter than using a loop, but often causes a stack overflow) END