Skip to content

Commit be94c55

Browse files
authored
fix: improve random seeds in standalone mode choice (#523)
1 parent c4b2b8f commit be94c55

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/main/java/org/eqasim/core/standalone_mode_choice/StandaloneModeChoicePerformer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,18 @@ public void run() throws InterruptedException, ExecutionException {
8888
"Splitting %d plans into %d chunks (%,d each) over %d threads",
8989
total, numChunks, chunkSize, numberOfThreads));
9090

91+
Random random = new Random(this.seed);
9192
for (int chunk = 0; chunk < numChunks; chunk++) {
9293
final int from = chunk * chunkSize;
9394
final int to = Math.min(from + chunkSize, total);
9495

9596
List<Plan> subList = selectedPlans.subList(from, to);
97+
Random chunkRandom = new Random(random.nextInt());
98+
9699
futures.add(exec.submit(() -> {
97100
PlanAlgoThread worker = new PlanAlgoThread(
98101
new DiscreteModeChoiceAlgorithm(
99-
new Random(seed),
102+
chunkRandom,
100103
discreteModeChoiceModelProvider.get(),
101104
population.getFactory(),
102105
new TripListConverter()

0 commit comments

Comments
 (0)