implement randpair