shorten RandomSearch codes.