This discussion is archived
2 Replies Latest reply: Jun 1, 2010 1:41 AM by YoungWinston RSS

Avoiding duplicates while generating pair of random numbers!

807580 Newbie
Currently Being Moderated
hi all,

Consider that I'm generating 50 edges randomly using Random class. The format of the edge will be (source,destination). So if I randomly generate the pair (1,2), it means that my source node is 1 and the destination node is 2 for my edge from 1 to 2.

I have a function to randomly generate say 50 edges and as and when I generate I display it to a text area.

Now the issue is, I want to make sure that I don't have duplicate edges. Can someone suggest a way to ensure that ?


Thanks!