Skip to content

Commit

Permalink
fix: flexible-rollout random stickiness is not random enough (#417)
Browse files Browse the repository at this point in the history
It's easy to get skew when we only pick numbers between 0 and 100.
  • Loading branch information
ivarconr committed Jan 17, 2023
1 parent 8dd7655 commit cc5b40e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/strategy/flexible-rollout-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const STICKINESS = {
};

export default class FlexibleRolloutStrategy extends Strategy {
private randomGenerator: Function = () => `${Math.round(Math.random() * 100) + 1}`;
private randomGenerator: Function = () => `${Math.round(Math.random() * 10000) + 1}`;

constructor(radnomGenerator?: Function) {
constructor(randomGenerator?: Function) {
super('flexibleRollout');
if (radnomGenerator) {
this.randomGenerator = radnomGenerator;
if (randomGenerator) {
this.randomGenerator = randomGenerator;
}
}

Expand Down

0 comments on commit cc5b40e

Please sign in to comment.