[ create a new paste ] login | about

Project: alcari
Link: http://alcari.codepad.org/QwmwlhnE    [ raw code | output | fork ]

Python, pasted on Aug 6:
1
2
3
4
5
6
7
import random 
def bogosort(l):
	while not reduce(lambda x,y:x and y,[l[n]<=l[n+1]for n in range(len(l)-1)]):
		random.shuffle(l)
	return l

print(bogosort([1, 5, 3, 2, 7, 2]))


Output:
1
[1, 2, 2, 3, 5, 7]


Create a new paste based on this one


Comments: