Skip to content

Commit

Permalink
loop until new partner is different
Browse files Browse the repository at this point in the history
  • Loading branch information
kanin-kearpimy committed Mar 12, 2024
1 parent c089d8c commit 904a3df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/model/model.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ export class Model {
return this.mutatePermutation();
}

const partner = min + 1 == max ? min : Paul.chooseBetween(max, min, BIAS.REVERSE_BELL);
if (chosen == partner) {
// would that ever happen ?
return this.mutatePermutation();
let partner = min + 1 == max ? min : Paul.chooseBetween(max, min, BIAS.REVERSE_BELL);
while (chosen == partner) {
partner = Paul.chooseBetween(max, min, BIAS.REVERSE_BELL);
}

const [a] = Model._order.splice(chosen, 1);

const b = Model._order[partner];
Expand Down

0 comments on commit 904a3df

Please sign in to comment.