random algorithm instead of sleeping, yay