Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ describe('user-segmentation-utils', () => {
distribution[Math.min(distributionIndex, 9)] += 1;
});

// Each range should have roughly 10% of the values and 30% deviation
// Each range should have roughly 10% of the values and 40% deviation
const expectedPerRange = samples / ranges.length;
const allowedDeviation = expectedPerRange * 0.3;
const allowedDeviation = expectedPerRange * 0.4;
Copy link
Contributor

@MajorLift MajorLift May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 40% a safe range for the test's requirements? It seems like this might relax the test into validating a very-roughly uniform distribution.😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great question. I'm not sure 😅 It seems like the range of values is wider than we expect. It also seems that if generateDeterministicRandomNumber is supposed to be deterministic, we don't have to use random UUIDs or user IDs in the test, we can use known values. But I assume that there is a specific reason we wrote the test this way and fixing it further seemed out of scope.


// Check distribution
distribution.forEach((count) => {
Expand Down
Loading