add connectRandom functon