New random algorithm