randh() function