turn the ptr_hash inline code into a true sub

Borrowed from autobox, which is released under the same terms as Perl.
randomize bucket split insertion in hsplit()