(collection)
| 27 | """ |
| 28 | |
| 29 | def isSorted(collection): |
| 30 | if len(collection) < 2: |
| 31 | return True |
| 32 | for i in range(len(collection) - 1): |
| 33 | if collection[i] > collection[i + 1]: |
| 34 | return False |
| 35 | return True |
| 36 | |
| 37 | while not isSorted(collection): |
| 38 | random.shuffle(collection) |