It's old code, maybe we should refactor a bit? look at the get_rand_data()