init ptr before get_random