From 5b0cad01a83cded094c938fa016841cc824a9ce7 Mon Sep 17 00:00:00 2001 From: Roger Chi Date: Sat, 26 Mar 2022 23:41:52 -0400 Subject: [PATCH] docs: add comment --- lib/constructs/sampling-rule.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/constructs/sampling-rule.ts b/lib/constructs/sampling-rule.ts index 314e20c..47eb594 100644 --- a/lib/constructs/sampling-rule.ts +++ b/lib/constructs/sampling-rule.ts @@ -31,7 +31,10 @@ export class SamplingRule extends Rule { if (percentage >= 1 || percentage <= 0) { throw new Error('Percentage must be between 0 and 1'); } + // Get the first three significant hex digits from the percentage const hexString = percentage.toString(16).slice(0, 5).slice(-3); + + // Build up list of prefixes, starting from most significant digit let prefixes: string[] = []; let a; for (a = 0x0; a < parseInt(hexString[0], 16); a++) {