Implement rand_gamma