Skip to content

Commit

Permalink
use absolute value of sip hash
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Sep 20, 2023
1 parent 04d98d0 commit c889510
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Result create(Operation operation) {
Integer nodeCount = intrinsic.params().getInteger(NODE_COUNT);
Integer node = intrinsic.params().getInteger(NODE, s -> {
requireParam(nodeCount, "nodeCount param required when providing a string node value");
return SIP.hashString(s, StandardCharsets.UTF_8).asInt() % nodeCount;
return Math.abs(SIP.hashString(s, StandardCharsets.UTF_8).asInt()) % nodeCount;
});

Long epoch = intrinsic.params().getLong(EPOCH);
Expand Down

0 comments on commit c889510

Please sign in to comment.