Got Kavya's random sampling code to work