complete new weak_link_distribution algorithm