Added rand_sample() function in cluster.cpp