3 ms·
Needs a shuffle() function - can't bogosort without it.
by ilikejam 15y ago
Needs a shuffle() function - can't bogosort without it.
- thedufer 15y agoYou should be able to write one with swaps - go for it.
- dekz 15y agoBogo shuffle = -> for x in [0..VA.length] VA.swap x, Math.floor(Math.random()*VA.length) sort = -> VA.play() if !checkSorted() shuffle() setTimeout(sort, 10) checkSorted = -> for x in [0..VA.length-1] if VA.gte(x, x+1) return false return true sort()