Algorithms for random generation and identification fo shared risks in optical networks