Implementation Details/Code for the Random Sampling Algorithm

Need to know where i can find some implementation details specifics or code related to the random sampling algorithm used for selecting peers