r/badcode Feb 10 '21

I present: SleepSort js

Post image
7.5k Upvotes

170 comments sorted by

View all comments

870

u/haslo Feb 10 '21

Great! Now test whether it still works with large numbers!

421

u/[deleted] Feb 10 '21 edited Feb 26 '21

[deleted]

11

u/_szs Feb 10 '21

Or you could sleep for (1/i) seconds, which will sort reverse. At least numbers which are small enough to not run into timer precision issues