vendredi 15 janvier 2016

Random distinct numbers in Java

I have a problem generating random edges for not directed graph in Java. The problem is exactly the same as here, but I don't have a randperm function from matlab. I tried with creating a list of size v*(v-1)*0.5, where v is a number of vertices in graph, and shuffling it. However I'm trying to generate 100 million edges in graph with 1 million vertices. The list with about 10e12entries is a real problem. So I need 100 million distinct numbers between 1 and 10e12 and have no idea how to get them.




Aucun commentaire:

Enregistrer un commentaire