r/ProgrammerHumor • • Aug 11 '20

Meme So Amazing!

Post image
1.8k Upvotes

137 comments sorted by

View all comments

Show parent comment

1

u/warmCabin Aug 11 '20

I wrote up an implementation of this in Java that uses a CountDownLatch to kick off all the sleeper threads simultaneously, then I fine-tuned the delay multiplier to I think 15 ms. I subtracted the min value from the sleep time so you could quickly sort numbers that range from, say, 1,000,000,000 to 1,000,000,100. A very common real world use case!