distributed samplerank code, may have some inefficiencies