I am creating an object with the same parameters multiple times over and over again. The object has a random method (using Math.random()) in it which I know should return a different number every time, but each time within the program I create a new object of that class and call the method on it, it returns the same value. How should I fix this?
place where I call the method contract:
for (int i = 0; i < 212000; i++){
Contractions c = new Contractions(a, b);
temp = c.contract();
if (temp < min){
min = temp;
}
if (i%1000 == 0){
System.out.println(min);
}
}
method:
while (vertices.size() > 2){
Edge randEdge = edges.get((int) (Math.random()*edges.size())); .....
return edges.size();
Aucun commentaire:
Enregistrer un commentaire