@mark1russell7/rigor-generators 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,6 +59,26 @@ A parameter is a number or a range `[min, max]`. `sampler` draws from a range on
59
59
 
60
60
  `Math.exp`, `Math.log` and `Math.pow` can give other results on another JavaScript engine. `dependsOnLibm` tells if a spec uses them. Only `recorded` does not, so write the numbers of the other families into a corpus when a corpus must match on each platform.
61
61
 
62
+ ### Recorded tables
63
+
64
+ A corpus can draw real sizes. Each table has 100 midpoint quantiles of the recorded values, with its source, its license and its date. `recordedSpec` gives the spec of the family `recorded` for a table.
65
+
66
+ | Table | Values | Source | License |
67
+ | --- | --- | --- | --- |
68
+ | `DIAGRAM_BOX_AREA` | the areas of 9859 boxes of 293 real diagrams | the Ptolemy II models of the ELK model set | the Ptolemy II license. The field `notice` keeps its text |
69
+ | `GIT_BLOB_BYTES` | the sizes of 20751 files of one git tree | `microsoft/vscode` | MIT |
70
+
71
+ The tables keep the values of one measure, so a table gives no link between the width and the height of a box.
72
+
73
+ `scripts/recorded-tables.ts` rebuilds the numbers from the two sources.
74
+
75
+ Each table is a sample, and it does not show a general law:
76
+
77
+ - `DIAGRAM_BOX_AREA` reads each model of `realworld/ptolemy/flattened`. One tool drew these diagrams, so a small set of icon sizes has a large share. It leaves out the 254 models of `realworld/ptolemy/hierarchical`, and 46 of these have no flattened model. It also leaves out the hand-made graphs of `tests`, `tickets` and `examples`.
78
+ - `GIT_BLOB_BYTES` reads each file of one tree, also the binary files. It leaves out 34 empty files. One repository is one project, so a table of another repository has other values.
79
+
80
+ The npm package holds the notice of the Ptolemy II license, because the field `notice` is part of the build.
81
+
62
82
  ## The input of `fnv1a32`
63
83
 
64
84
  The option `input` of `fnv1a32` selects the units that the hash reads. Use it to replace a local copy of FNV-1a with the same hashes.
package/build/index.d.ts CHANGED
@@ -99,5 +99,37 @@ export declare function sampler(spec: DistributionSpec, r: Random): () => number
99
99
  * The result of those functions can change between JavaScript engines. Thus such a family has the same numbers only on one platform.
100
100
  */
101
101
  export declare function dependsOnLibm(spec: DistributionSpec): boolean;
102
- export type { DistributionSpec, Param, Random, Source };
102
+ /** A table of recorded values and the facts of its source. */
103
+ interface RecordedTable {
104
+ /** The name of the table. */
105
+ readonly name: string;
106
+ /** What one value measures. */
107
+ readonly measure: string;
108
+ /** The link to the source, with the commit of the read. */
109
+ readonly source: string;
110
+ /** The license of the source. */
111
+ readonly license: string;
112
+ /** The notice of the license of the source, or an empty string when it has no notice. */
113
+ readonly notice: string;
114
+ /** The date of the read. */
115
+ readonly date: string;
116
+ /** The count of the recorded values. */
117
+ readonly count: number;
118
+ /** The median of the recorded values. */
119
+ readonly median: number;
120
+ /**
121
+ * The 100 midpoint quantiles, from the lowest to the highest.
122
+ * The value at index `i` has the rank `floor(count * (i + 0.5) / 100)` of the sorted values. Each value thus stands for 1 percent of the recorded values.
123
+ */
124
+ readonly quantiles: readonly number[];
125
+ }
126
+ /** The areas of the boxes of 293 real diagrams: the actors of the Ptolemy II models, in the flattened form of the ELK model set. */
127
+ export declare const DIAGRAM_BOX_AREA: RecordedTable;
128
+ /** The sizes of the files of one large public git tree. A treemap of a repository has weights of this kind. */
129
+ export declare const GIT_BLOB_BYTES: RecordedTable;
130
+ /** The recorded tables, by name. */
131
+ export declare const RECORDED_TABLES: Readonly<Record<string, RecordedTable>>;
132
+ /** This function gives the spec of the family `recorded` that draws from a table. */
133
+ export declare function recordedSpec(table: RecordedTable): DistributionSpec;
134
+ export type { DistributionSpec, Param, Random, RecordedTable, Source };
103
135
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/random.ts","../src/distributions.ts"],"mappings":";;;;;;;;KASY;;wBAGI,WAAW,eAAe;;;;;;;;;;wBAsB1B,QAAQ,cAAc;WAAqB;;;wBAiC3C,OAAO;;wBAOP,WAAW,cAAc;UAIxB;;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;;KCtLzC,2BAA2B,aAAa;;KAGxC;WACG;WAA8B,IAAI;WAAgB,OAAO;;WACzD;WAA2B,OAAO;WAAgB,OAAO;;WACzD;WAAyB;WAAoB,UAAU;;WACvD;WAAyB,GAAG;WAAgB,GAAG;;WAC/C;WAA4B;aAA2B;aAAyB,MAAM;;;WACtF;WAA6B;;;;;;wBAsD5B,QAAQ,MAAM,kBAAkB,GAAG;;;;;wBAkDnC,cAAc,MAAM;;UCjHnB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;;qBAIE,kBAAkB;;qBAwBlB,gBAAgB;;qBAwBhB,iBAAiB,SAAS,eAAe;;wBAMtC,aAAa,OAAO,gBAAgB"}
package/build/index.js CHANGED
@@ -97,6 +97,245 @@ function dependsOnLibm(spec) {
97
97
  if (spec.family === "mixture") return spec.parts.some(({ part }) => dependsOnLibm(part));
98
98
  return true;
99
99
  }
100
+ // src/recorded.ts
101
+ /** The areas of the boxes of 293 real diagrams: the actors of the Ptolemy II models, in the flattened form of the ELK model set. */
102
+ const DIAGRAM_BOX_AREA = Object.freeze({
103
+ name: "diagram-box-area",
104
+ measure: "the area of one box of a diagram, in square layout units",
105
+ source: "https://github.com/eclipse-elk/elk-models/tree/ac5af2ba511c0037e4f347e8bd91f013950951c7/realworld/ptolemy/flattened",
106
+ license: "The Ptolemy II license of the University of California, stated in realworld/ptolemy/README.txt of the source",
107
+ notice: "Copyright (c) 1997-2013 The Regents of the University of California.\nAll rights reserved.\nPermission is hereby granted, without written agreement and without\nlicense or royalty fees, to use, copy, modify, and distribute this\nsoftware and its documentation for any purpose, provided that the above\ncopyright notice and the following two paragraphs appear in all copies\nof this software.\n\nIN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY\nFOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\nARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF\nTHE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGE.\n\nTHE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE\nPROVIDED HEREUNDER IS ON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF\nCALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,\nENHANCEMENTS, OR MODIFICATIONS.",
108
+ date: "2026-11-04",
109
+ count: 9859,
110
+ median: 2024,
111
+ quantiles: Object.freeze([
112
+ 350,
113
+ 410,
114
+ 410,
115
+ 410,
116
+ 450,
117
+ 450,
118
+ 475,
119
+ 650,
120
+ 725,
121
+ 725,
122
+ 800,
123
+ 825,
124
+ 861,
125
+ 861,
126
+ 900,
127
+ 912,
128
+ 912,
129
+ 912,
130
+ 961,
131
+ 961,
132
+ 961,
133
+ 1025,
134
+ 1150,
135
+ 1250,
136
+ 1271,
137
+ 1271,
138
+ 1475,
139
+ 1681,
140
+ 1681,
141
+ 1681,
142
+ 1681,
143
+ 1681,
144
+ 1681,
145
+ 1681,
146
+ 1681,
147
+ 1681,
148
+ 1681,
149
+ 1681,
150
+ 1681,
151
+ 1681,
152
+ 1681,
153
+ 1681,
154
+ 1794,
155
+ 1794,
156
+ 1794,
157
+ 1875,
158
+ 1891,
159
+ 1914,
160
+ 1927,
161
+ 1975,
162
+ 2024,
163
+ 2100,
164
+ 2350,
165
+ 2400,
166
+ 2400,
167
+ 2400,
168
+ 2400,
169
+ 2400,
170
+ 2400,
171
+ 2400,
172
+ 2400,
173
+ 2400,
174
+ 2400,
175
+ 2400,
176
+ 2400,
177
+ 2400,
178
+ 2400,
179
+ 2441,
180
+ 2501,
181
+ 2501,
182
+ 2501,
183
+ 2501,
184
+ 2501,
185
+ 2501,
186
+ 2501,
187
+ 2501,
188
+ 2501,
189
+ 2501,
190
+ 2501,
191
+ 2501,
192
+ 2501,
193
+ 2501,
194
+ 2501,
195
+ 2600,
196
+ 3036,
197
+ 3036,
198
+ 3036,
199
+ 3036,
200
+ 3036,
201
+ 3036,
202
+ 3036,
203
+ 3036,
204
+ 3036,
205
+ 3036,
206
+ 3036,
207
+ 3358,
208
+ 3600,
209
+ 4900,
210
+ 5975,
211
+ 10625
212
+ ])
213
+ });
214
+ /** The sizes of the files of one large public git tree. A treemap of a repository has weights of this kind. */
215
+ const GIT_BLOB_BYTES = Object.freeze({
216
+ name: "git-blob-bytes",
217
+ measure: "the size of one file of a git tree, in bytes. Empty files are left out",
218
+ source: "https://github.com/microsoft/vscode/tree/aace354316214ca620b7c809a3da1ed59bf942dd",
219
+ license: "MIT",
220
+ notice: "",
221
+ date: "2026-11-04",
222
+ count: 20751,
223
+ median: 4454,
224
+ quantiles: Object.freeze([
225
+ 8,
226
+ 63,
227
+ 132,
228
+ 216,
229
+ 265,
230
+ 326,
231
+ 413,
232
+ 447,
233
+ 474,
234
+ 505,
235
+ 542,
236
+ 578,
237
+ 625,
238
+ 665,
239
+ 708,
240
+ 772,
241
+ 831,
242
+ 903,
243
+ 981,
244
+ 1051,
245
+ 1128,
246
+ 1190,
247
+ 1272,
248
+ 1354,
249
+ 1435,
250
+ 1514,
251
+ 1593,
252
+ 1668,
253
+ 1757,
254
+ 1851,
255
+ 1936,
256
+ 2030,
257
+ 2122,
258
+ 2220,
259
+ 2335,
260
+ 2442,
261
+ 2561,
262
+ 2680,
263
+ 2805,
264
+ 2925,
265
+ 3052,
266
+ 3186,
267
+ 3335,
268
+ 3459,
269
+ 3617,
270
+ 3765,
271
+ 3902,
272
+ 4055,
273
+ 4209,
274
+ 4380,
275
+ 4524,
276
+ 4718,
277
+ 4876,
278
+ 5092,
279
+ 5282,
280
+ 5487,
281
+ 5720,
282
+ 5933,
283
+ 6143,
284
+ 6388,
285
+ 6657,
286
+ 6939,
287
+ 7211,
288
+ 7513,
289
+ 7853,
290
+ 8190,
291
+ 8496,
292
+ 8817,
293
+ 9183,
294
+ 9574,
295
+ 9943,
296
+ 10367,
297
+ 10758,
298
+ 11294,
299
+ 11797,
300
+ 12355,
301
+ 12903,
302
+ 13619,
303
+ 14240,
304
+ 14994,
305
+ 15751,
306
+ 16593,
307
+ 17546,
308
+ 18678,
309
+ 19722,
310
+ 21129,
311
+ 22639,
312
+ 24080,
313
+ 25906,
314
+ 27915,
315
+ 30174,
316
+ 32771,
317
+ 36281,
318
+ 40324,
319
+ 46261,
320
+ 54344,
321
+ 63697,
322
+ 84365,
323
+ 122821,
324
+ 233638
325
+ ])
326
+ });
327
+ /** The recorded tables, by name. */
328
+ const RECORDED_TABLES = Object.freeze({
329
+ [DIAGRAM_BOX_AREA.name]: DIAGRAM_BOX_AREA,
330
+ [GIT_BLOB_BYTES.name]: GIT_BLOB_BYTES
331
+ });
332
+ /** This function gives the spec of the family `recorded` that draws from a table. */
333
+ function recordedSpec(table) {
334
+ return {
335
+ family: "recorded",
336
+ values: table.quantiles
337
+ };
338
+ }
100
339
  // src/random.ts
101
340
  /** The generator mulberry32. The seed is read as a 32-bit unsigned integer. */
102
341
  function mulberry32(seed) {
@@ -244,6 +483,6 @@ function seedsFrom(given, defaults) {
244
483
  if (!Number.isSafeInteger(seed)) throw new RangeError(`seedsFrom: a seed is an integer, not ${given}.`);
245
484
  return [seed];
246
485
  }
247
- export { dependsOnLibm, deriveSeed, fnv1a32, mulberry32, random, randomOf, sampler, seedOf, seedsFrom };
486
+ export { DIAGRAM_BOX_AREA, GIT_BLOB_BYTES, RECORDED_TABLES, dependsOnLibm, deriveSeed, fnv1a32, mulberry32, random, randomOf, recordedSpec, sampler, seedOf, seedsFrom };
248
487
 
249
488
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/distributions.ts","../src/random.ts"],"sourcesContent":["// Open families of distributions for generated inputs. A family has parameters, and a parameter can be a range.\n// A corpus names a point of a family, so a new size distribution does not need a new closed value.\nimport type { Random } from \"./random.ts\";\n\n/** A parameter of a family: one value, or a range from `min` to `max` that `sampler` draws from once. */\nexport type Param = number | readonly [min: number, max: number];\n\n/** A family of distributions and its parameters. */\nexport type DistributionSpec =\n | { readonly family: \"lognormal\"; readonly mu: Param; readonly sigma: Param }\n | { readonly family: \"pareto\"; readonly scale: Param; readonly shape: Param }\n | { readonly family: \"zipf\"; readonly n: number; readonly exponent: Param }\n | { readonly family: \"beta\"; readonly a: Param; readonly b: Param }\n | { readonly family: \"mixture\"; readonly parts: readonly { readonly weight: number; readonly part: DistributionSpec }[] }\n | { readonly family: \"recorded\"; readonly values: readonly number[] };\n\n/** This function examines a parameter. Both ends of a range must pass `valid`. */\nfunction checked(family: string, name: string, param: Param, valid: (value: number) => boolean, rule: string): void {\n const ends = typeof param === \"number\" ? [param] : param;\n for (const value of ends) {\n if (!Number.isFinite(value) || !valid(value)) throw new RangeError(`${family}: ${name} is ${value}, and it must be ${rule}.`);\n }\n if (typeof param !== \"number\" && param[0] > param[1]) throw new RangeError(`${family}: the range of ${name} starts above its end.`);\n}\n\n/** This function gives the value of a parameter: the number, or one draw from the range. */\nfunction valueOf(param: Param, r: Random): number {\n return typeof param === \"number\" ? param : r.range(param[0], param[1]);\n}\n\n/** This function gives a gamma sample with the scale 1 (Marsaglia and Tsang, 2000). A shape below 1 uses the boost `U^(1/shape)`. */\nfunction gamma(r: Random, shape: number): number {\n if (shape < 1) return gamma(r, shape + 1) * Math.pow(1 - r.next(), 1 / shape);\n const d = shape - 1 / 3;\n const c = 1 / Math.sqrt(9 * d);\n for (;;) {\n const x = r.normal();\n const v = (1 + c * x) ** 3;\n if (v <= 0) continue;\n if (Math.log(1 - r.next()) < 0.5 * x * x + d - d * v + d * Math.log(v)) return d * v;\n }\n}\n\n/** This function gives the sampler of the ranks from 1 to `n`, with a probability in proportion to `rank^-exponent`. */\nfunction zipfSampler(n: number, exponent: number, r: Random): () => number {\n const totals: number[] = [];\n let total = 0;\n for (let rank = 1; rank <= n; rank++) {\n total += Math.pow(rank, -exponent);\n totals.push(total);\n }\n return () => {\n const at = r.next() * total;\n let lo = 0;\n let hi = n - 1;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (totals[mid]! > at) hi = mid;\n else lo = mid + 1;\n }\n return lo + 1;\n };\n}\n\n/**\n * This function gives a sampler of a family. It fixes each parameter once, so a range gives one point of the family.\n * Each call of the sampler gives one number. The same seed and the same spec give the same numbers on one platform.\n */\nexport function sampler(spec: DistributionSpec, r: Random): () => number {\n switch (spec.family) {\n case \"lognormal\": {\n checked(\"lognormal\", \"sigma\", spec.sigma, (v) => v >= 0, \"0 or more\");\n checked(\"lognormal\", \"mu\", spec.mu, () => true, \"finite\");\n const mu = valueOf(spec.mu, r);\n const sigma = valueOf(spec.sigma, r);\n return () => Math.exp(r.normal(mu, sigma));\n }\n case \"pareto\": {\n checked(\"pareto\", \"scale\", spec.scale, (v) => v > 0, \"above 0\");\n checked(\"pareto\", \"shape\", spec.shape, (v) => v > 0, \"above 0\");\n const scale = valueOf(spec.scale, r);\n const shape = valueOf(spec.shape, r);\n return () => scale / Math.pow(1 - r.next(), 1 / shape);\n }\n case \"zipf\": {\n if (!Number.isSafeInteger(spec.n) || spec.n < 1) throw new RangeError(`zipf: n is ${spec.n}, and it must be a whole number of 1 or more.`);\n checked(\"zipf\", \"exponent\", spec.exponent, (v) => v >= 0, \"0 or more\");\n return zipfSampler(spec.n, valueOf(spec.exponent, r), r);\n }\n case \"beta\": {\n checked(\"beta\", \"a\", spec.a, (v) => v > 0, \"above 0\");\n checked(\"beta\", \"b\", spec.b, (v) => v > 0, \"above 0\");\n const a = valueOf(spec.a, r);\n const b = valueOf(spec.b, r);\n return () => {\n const x = gamma(r, a);\n return x / (x + gamma(r, b));\n };\n }\n case \"mixture\": {\n if (spec.parts.length === 0) throw new RangeError(\"mixture: the list of the parts is empty.\");\n for (const { weight } of spec.parts) checked(\"mixture\", \"weight\", weight, (v) => v > 0, \"above 0\");\n const parts = spec.parts.map(({ part }) => sampler(part, r));\n const weights = spec.parts.map(({ weight }) => weight);\n return () => parts[r.weighted(weights)]!();\n }\n case \"recorded\": {\n if (spec.values.length === 0) throw new RangeError(\"recorded: the list of the values is empty.\");\n for (const value of spec.values) checked(\"recorded\", \"value\", value, () => true, \"finite\");\n return () => r.pick(spec.values);\n }\n }\n}\n\n/**\n * This function tells if the numbers of a family use `Math.exp`, `Math.log` or `Math.pow`.\n * The result of those functions can change between JavaScript engines. Thus such a family has the same numbers only on one platform.\n */\nexport function dependsOnLibm(spec: DistributionSpec): boolean {\n if (spec.family === \"recorded\") return false;\n if (spec.family === \"mixture\") return spec.parts.some(({ part }) => dependsOnLibm(part));\n return true;\n}\n","/**\n * A pseudo-random number generator with a seed, and the draws that tests and benchmarks make from it.\n *\n * The generator is mulberry32. It is fast, it has 32 bits of state and it gives the same sequence for\n * the same seed on each platform. It is not for cryptography. Each repository that copied mulberry32\n * gets the same numbers from `random(seed).next`, so a move to this package keeps the records equal.\n */\n\n/** A source of uniform numbers from 0 (included) to 1 (not included). */\nexport type Source = () => number;\n\n/** The generator mulberry32. The seed is read as a 32-bit unsigned integer. */\nexport function mulberry32(seed: number): Source {\n let state = seed >>> 0;\n return () => {\n state = (state + 0x6d2b79f5) >>> 0;\n let t = state;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nconst UTF8 = new TextEncoder();\n\n/**\n * The FNV-1a hash of 32 bits of a string. The option `input` selects the units that the hash reads:\n *\n * - `\"utf8\"` (the default): the UTF-8 bytes from `TextEncoder`. A lone surrogate becomes the bytes of U+FFFD.\n * - `\"utf16\"`: the UTF-16 code units of the string, one unit for each step, from `charCodeAt`.\n * - `\"wtf8\"`: the UTF-8 bytes of each code point. A lone surrogate becomes its own 3 bytes (WTF-8).\n *\n * For a string without a lone surrogate, `\"utf8\"` and `\"wtf8\"` give the same hash.\n */\nexport function fnv1a32(text: string, options?: { readonly input?: \"utf8\" | \"utf16\" | \"wtf8\" }): number {\n const input = options?.input ?? \"utf8\";\n let h = 0x811c9dc5;\n if (input === \"utf16\") {\n for (let i = 0; i < text.length; i++) h = Math.imul(h ^ text.charCodeAt(i), 0x01000193);\n return h >>> 0;\n }\n if (input === \"wtf8\") {\n for (const ch of text) {\n const c = ch.codePointAt(0) as number;\n if (c < 0x80) h = Math.imul(h ^ c, 0x01000193);\n else if (c < 0x800) {\n h = Math.imul(h ^ (0xc0 | (c >> 6)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n } else if (c < 0x10000) {\n h = Math.imul(h ^ (0xe0 | (c >> 12)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 6) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n } else {\n h = Math.imul(h ^ (0xf0 | (c >> 18)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 12) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 6) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n }\n }\n return h >>> 0;\n }\n if (input !== \"utf8\") throw new RangeError(`fnv1a32: input is \"utf8\", \"utf16\" or \"wtf8\", not ${String(input)}.`);\n for (const b of UTF8.encode(text)) h = Math.imul(h ^ b, 0x01000193) >>> 0;\n return h;\n}\n\n/** The 32-bit seed of a number (its low 32 bits, unsigned) or of a string (its FNV-1a hash). */\nexport function seedOf(seed: number | string): number {\n if (typeof seed === \"string\") return fnv1a32(seed);\n if (!Number.isFinite(seed)) throw new RangeError(`seedOf: a seed is a finite number or a string, not ${seed}.`);\n return seed >>> 0;\n}\n\n/** The seed of the stream with the name `label` under `seed`: the hash of `\"<seed>:<label>\"`. */\nexport function deriveSeed(seed: number, label: string): number {\n return fnv1a32(`${seed}:${label}`);\n}\n\nexport interface Random {\n /** The 32-bit seed that the generator started with. Write it in each failure message, so a run can replay. */\n readonly seed: number;\n /** A uniform number from 0 (included) to 1 (not included). */\n next(): number;\n /** A uniform integer from `min` to `max`, both included. */\n int(min: number, max: number): number;\n /** A uniform integer from 0 (included) to `n` (not included). */\n below(n: number): number;\n /** A uniform number from `min` (included) to `max` (not included). */\n range(min: number, max: number): number;\n /** `true` with the probability `p`. */\n chance(p: number): boolean;\n /** One item of a list that is not empty, each with the same probability. */\n pick<T>(items: readonly T[]): T;\n /** The index of a weight, with a probability in proportion to the weight. One draw. */\n weighted(weights: readonly number[]): number;\n /** A new list with the items in a uniform random order (Fisher–Yates, from the end). */\n shuffle<T>(items: readonly T[]): T[];\n /** `k` different items of a list, in the order of the draw (a partial Fisher–Yates). */\n sample<T>(items: readonly T[], k: number): T[];\n /** A normal sample (Box–Muller, two draws). */\n normal(mean?: number, sd?: number): number;\n /** An independent generator for the part of the work with the name `label`. The same labels give the same streams. */\n fork(label: string): Random;\n}\n\nfunction wholeOrThrow(name: string, value: number): void {\n if (!Number.isSafeInteger(value)) throw new RangeError(`${name}: ${value} is not a safe integer.`);\n}\n\n/** A generator with draws, from a seed. The default source is mulberry32. */\nexport function random(seed: number | string, source: (seed: number) => Source = mulberry32): Random {\n const start = seedOf(seed);\n return randomOf(source(start), start, source);\n}\n\n/** A generator with draws, from a source that you give. `fork` uses `source` for the new streams. */\nexport function randomOf(next: Source, seed: number, source: (seed: number) => Source = mulberry32): Random {\n const below = (n: number): number => {\n wholeOrThrow(\"below\", n);\n if (n < 1) throw new RangeError(`below: n is 1 or more, not ${n}.`);\n return Math.floor(next() * n);\n };\n return {\n seed,\n next,\n int(min, max) {\n wholeOrThrow(\"int\", min);\n wholeOrThrow(\"int\", max);\n if (min > max) throw new RangeError(`int: min ${min} is more than max ${max}.`);\n return min + Math.floor(next() * (max - min + 1));\n },\n below,\n range: (min, max) => min + next() * (max - min),\n chance: (p) => next() < p,\n pick(items) {\n if (items.length === 0) throw new RangeError(\"pick: the list is empty.\");\n return items[below(items.length)] as (typeof items)[number];\n },\n weighted(weights) {\n let total = 0;\n for (const w of weights) {\n if (!(Number.isFinite(w) && w >= 0)) throw new RangeError(`weighted: each weight is finite and 0 or more, not ${w}.`);\n total += w;\n }\n if (!(total > 0)) throw new RangeError(\"weighted: the sum of the weights is 0.\");\n let left = next() * total;\n for (let i = 0; i < weights.length; i++) {\n left -= weights[i] as number;\n if (left < 0) return i;\n }\n // Rounding can leave a small remainder: give the last index with a weight.\n for (let i = weights.length - 1; ; i--) if ((weights[i] as number) > 0) return i;\n },\n shuffle(items) {\n const out = [...items];\n for (let i = out.length - 1; i > 0; i--) {\n const j = below(i + 1);\n [out[i], out[j]] = [out[j] as (typeof out)[number], out[i] as (typeof out)[number]];\n }\n return out;\n },\n sample(items, k) {\n wholeOrThrow(\"sample\", k);\n if (k < 0 || k > items.length) throw new RangeError(`sample: k is from 0 to ${items.length}, not ${k}.`);\n const out = [...items];\n for (let i = 0; i < k; i++) {\n const j = i + below(out.length - i);\n [out[i], out[j]] = [out[j] as (typeof out)[number], out[i] as (typeof out)[number]];\n }\n return out.slice(0, k);\n },\n normal(mean = 0, sd = 1) {\n const u1 = Math.max(next(), 1e-12);\n const u2 = next();\n return mean + sd * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);\n },\n fork(label) {\n const child = deriveSeed(seed, label);\n return randomOf(source(child), child, source);\n },\n };\n}\n\n/**\n * The seeds of a run: the seed in `given` (the text of an environment variable, for example\n * `process.env.SEED`), else the default seeds. An empty text gives the defaults.\n */\nexport function seedsFrom(given: string | undefined, defaults: readonly number[]): number[] {\n if (given === undefined || given.trim() === \"\") return [...defaults];\n const seed = Number(given);\n if (!Number.isSafeInteger(seed)) throw new RangeError(`seedsFrom: a seed is an integer, not ${given}.`);\n return [seed];\n}\n"],"mappings":";;AAiBA,SAAS,QAAQ,QAAgB,MAAc,OAAc,O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O,KAAK,GAAG,OAAO,MAAM;EAC9C;CACF;AACF;;;;;AAMA,SAAgB,UAAU,OAA2B,UAAuC;CAC1F,IAAI,UAAU,KAAA,KAAa,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,QAAQ;CACnE,MAAM,OAAO,OAAO,KAAK;CACzB,IAAI,CAAC,OAAO,cAAc,IAAI,GAAG,MAAM,IAAI,WAAW,wCAAwC,MAAM,EAAE;CACtG,OAAO,CAAC,IAAI;AACd"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/distributions.ts","../src/recorded.ts","../src/random.ts"],"sourcesContent":["// Open families of distributions for generated inputs. A family has parameters, and a parameter can be a range.\n// A corpus names a point of a family, so a new size distribution does not need a new closed value.\nimport type { Random } from \"./random.ts\";\n\n/** A parameter of a family: one value, or a range from `min` to `max` that `sampler` draws from once. */\nexport type Param = number | readonly [min: number, max: number];\n\n/** A family of distributions and its parameters. */\nexport type DistributionSpec =\n | { readonly family: \"lognormal\"; readonly mu: Param; readonly sigma: Param }\n | { readonly family: \"pareto\"; readonly scale: Param; readonly shape: Param }\n | { readonly family: \"zipf\"; readonly n: number; readonly exponent: Param }\n | { readonly family: \"beta\"; readonly a: Param; readonly b: Param }\n | { readonly family: \"mixture\"; readonly parts: readonly { readonly weight: number; readonly part: DistributionSpec }[] }\n | { readonly family: \"recorded\"; readonly values: readonly number[] };\n\n/** This function examines a parameter. Both ends of a range must pass `valid`. */\nfunction checked(family: string, name: string, param: Param, valid: (value: number) => boolean, rule: string): void {\n const ends = typeof param === \"number\" ? [param] : param;\n for (const value of ends) {\n if (!Number.isFinite(value) || !valid(value)) throw new RangeError(`${family}: ${name} is ${value}, and it must be ${rule}.`);\n }\n if (typeof param !== \"number\" && param[0] > param[1]) throw new RangeError(`${family}: the range of ${name} starts above its end.`);\n}\n\n/** This function gives the value of a parameter: the number, or one draw from the range. */\nfunction valueOf(param: Param, r: Random): number {\n return typeof param === \"number\" ? param : r.range(param[0], param[1]);\n}\n\n/** This function gives a gamma sample with the scale 1 (Marsaglia and Tsang, 2000). A shape below 1 uses the boost `U^(1/shape)`. */\nfunction gamma(r: Random, shape: number): number {\n if (shape < 1) return gamma(r, shape + 1) * Math.pow(1 - r.next(), 1 / shape);\n const d = shape - 1 / 3;\n const c = 1 / Math.sqrt(9 * d);\n for (;;) {\n const x = r.normal();\n const v = (1 + c * x) ** 3;\n if (v <= 0) continue;\n if (Math.log(1 - r.next()) < 0.5 * x * x + d - d * v + d * Math.log(v)) return d * v;\n }\n}\n\n/** This function gives the sampler of the ranks from 1 to `n`, with a probability in proportion to `rank^-exponent`. */\nfunction zipfSampler(n: number, exponent: number, r: Random): () => number {\n const totals: number[] = [];\n let total = 0;\n for (let rank = 1; rank <= n; rank++) {\n total += Math.pow(rank, -exponent);\n totals.push(total);\n }\n return () => {\n const at = r.next() * total;\n let lo = 0;\n let hi = n - 1;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (totals[mid]! > at) hi = mid;\n else lo = mid + 1;\n }\n return lo + 1;\n };\n}\n\n/**\n * This function gives a sampler of a family. It fixes each parameter once, so a range gives one point of the family.\n * Each call of the sampler gives one number. The same seed and the same spec give the same numbers on one platform.\n */\nexport function sampler(spec: DistributionSpec, r: Random): () => number {\n switch (spec.family) {\n case \"lognormal\": {\n checked(\"lognormal\", \"sigma\", spec.sigma, (v) => v >= 0, \"0 or more\");\n checked(\"lognormal\", \"mu\", spec.mu, () => true, \"finite\");\n const mu = valueOf(spec.mu, r);\n const sigma = valueOf(spec.sigma, r);\n return () => Math.exp(r.normal(mu, sigma));\n }\n case \"pareto\": {\n checked(\"pareto\", \"scale\", spec.scale, (v) => v > 0, \"above 0\");\n checked(\"pareto\", \"shape\", spec.shape, (v) => v > 0, \"above 0\");\n const scale = valueOf(spec.scale, r);\n const shape = valueOf(spec.shape, r);\n return () => scale / Math.pow(1 - r.next(), 1 / shape);\n }\n case \"zipf\": {\n if (!Number.isSafeInteger(spec.n) || spec.n < 1) throw new RangeError(`zipf: n is ${spec.n}, and it must be a whole number of 1 or more.`);\n checked(\"zipf\", \"exponent\", spec.exponent, (v) => v >= 0, \"0 or more\");\n return zipfSampler(spec.n, valueOf(spec.exponent, r), r);\n }\n case \"beta\": {\n checked(\"beta\", \"a\", spec.a, (v) => v > 0, \"above 0\");\n checked(\"beta\", \"b\", spec.b, (v) => v > 0, \"above 0\");\n const a = valueOf(spec.a, r);\n const b = valueOf(spec.b, r);\n return () => {\n const x = gamma(r, a);\n return x / (x + gamma(r, b));\n };\n }\n case \"mixture\": {\n if (spec.parts.length === 0) throw new RangeError(\"mixture: the list of the parts is empty.\");\n for (const { weight } of spec.parts) checked(\"mixture\", \"weight\", weight, (v) => v > 0, \"above 0\");\n const parts = spec.parts.map(({ part }) => sampler(part, r));\n const weights = spec.parts.map(({ weight }) => weight);\n return () => parts[r.weighted(weights)]!();\n }\n case \"recorded\": {\n if (spec.values.length === 0) throw new RangeError(\"recorded: the list of the values is empty.\");\n for (const value of spec.values) checked(\"recorded\", \"value\", value, () => true, \"finite\");\n return () => r.pick(spec.values);\n }\n }\n}\n\n/**\n * This function tells if the numbers of a family use `Math.exp`, `Math.log` or `Math.pow`.\n * The result of those functions can change between JavaScript engines. Thus such a family has the same numbers only on one platform.\n */\nexport function dependsOnLibm(spec: DistributionSpec): boolean {\n if (spec.family === \"recorded\") return false;\n if (spec.family === \"mixture\") return spec.parts.some(({ part }) => dependsOnLibm(part));\n return true;\n}\n","// Tables of sizes that were recorded from public sources. A corpus can then draw real sizes with the family `recorded`.\n// Each table keeps its source, its license and its date, so a reader can check each table.\nimport type { DistributionSpec } from \"./distributions.ts\";\n\n/** A table of recorded values and the facts of its source. */\nexport interface RecordedTable {\n /** The name of the table. */\n readonly name: string;\n /** What one value measures. */\n readonly measure: string;\n /** The link to the source, with the commit of the read. */\n readonly source: string;\n /** The license of the source. */\n readonly license: string;\n /** The notice of the license of the source, or an empty string when it has no notice. */\n readonly notice: string;\n /** The date of the read. */\n readonly date: string;\n /** The count of the recorded values. */\n readonly count: number;\n /** The median of the recorded values. */\n readonly median: number;\n /**\n * The 100 midpoint quantiles, from the lowest to the highest.\n * The value at index `i` has the rank `floor(count * (i + 0.5) / 100)` of the sorted values. Each value thus stands for 1 percent of the recorded values.\n */\n readonly quantiles: readonly number[];\n}\n\n/** The areas of the boxes of 293 real diagrams: the actors of the Ptolemy II models, in the flattened form of the ELK model set. */\nexport const DIAGRAM_BOX_AREA: RecordedTable = Object.freeze({\n name: \"diagram-box-area\",\n measure: \"the area of one box of a diagram, in square layout units\",\n source: \"https://github.com/eclipse-elk/elk-models/tree/ac5af2ba511c0037e4f347e8bd91f013950951c7/realworld/ptolemy/flattened\",\n license: \"The Ptolemy II license of the University of California, stated in realworld/ptolemy/README.txt of the source\",\n notice: \"Copyright (c) 1997-2013 The Regents of the University of California.\\nAll rights reserved.\\nPermission is hereby granted, without written agreement and without\\nlicense or royalty fees, to use, copy, modify, and distribute this\\nsoftware and its documentation for any purpose, provided that the above\\ncopyright notice and the following two paragraphs appear in all copies\\nof this software.\\n\\nIN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY\\nFOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\\nARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF\\nTHE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF\\nSUCH DAMAGE.\\n\\nTHE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE\\nPROVIDED HEREUNDER IS ON AN \\\"AS IS\\\" BASIS, AND THE UNIVERSITY OF\\nCALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,\\nENHANCEMENTS, OR MODIFICATIONS.\",\n date: \"2026-11-04\",\n count: 9859,\n median: 2024,\n quantiles: Object.freeze([\n 350, 410, 410, 410, 450, 450, 475, 650, 725, 725,\n 800, 825, 861, 861, 900, 912, 912, 912, 961, 961,\n 961, 1025, 1150, 1250, 1271, 1271, 1475, 1681, 1681, 1681,\n 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681, 1681,\n 1681, 1681, 1794, 1794, 1794, 1875, 1891, 1914, 1927, 1975,\n 2024, 2100, 2350, 2400, 2400, 2400, 2400, 2400, 2400, 2400,\n 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2441, 2501, 2501,\n 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501,\n 2501, 2501, 2501, 2600, 3036, 3036, 3036, 3036, 3036, 3036,\n 3036, 3036, 3036, 3036, 3036, 3358, 3600, 4900, 5975, 10625,\n ]),\n});\n\n/** The sizes of the files of one large public git tree. A treemap of a repository has weights of this kind. */\nexport const GIT_BLOB_BYTES: RecordedTable = Object.freeze({\n name: \"git-blob-bytes\",\n measure: \"the size of one file of a git tree, in bytes. Empty files are left out\",\n source: \"https://github.com/microsoft/vscode/tree/aace354316214ca620b7c809a3da1ed59bf942dd\",\n license: \"MIT\",\n notice: \"\",\n date: \"2026-11-04\",\n count: 20751,\n median: 4454,\n quantiles: Object.freeze([\n 8, 63, 132, 216, 265, 326, 413, 447, 474, 505,\n 542, 578, 625, 665, 708, 772, 831, 903, 981, 1051,\n 1128, 1190, 1272, 1354, 1435, 1514, 1593, 1668, 1757, 1851,\n 1936, 2030, 2122, 2220, 2335, 2442, 2561, 2680, 2805, 2925,\n 3052, 3186, 3335, 3459, 3617, 3765, 3902, 4055, 4209, 4380,\n 4524, 4718, 4876, 5092, 5282, 5487, 5720, 5933, 6143, 6388,\n 6657, 6939, 7211, 7513, 7853, 8190, 8496, 8817, 9183, 9574,\n 9943, 10367, 10758, 11294, 11797, 12355, 12903, 13619, 14240, 14994,\n 15751, 16593, 17546, 18678, 19722, 21129, 22639, 24080, 25906, 27915,\n 30174, 32771, 36281, 40324, 46261, 54344, 63697, 84365, 122821, 233638,\n ]),\n});\n\n/** The recorded tables, by name. */\nexport const RECORDED_TABLES: Readonly<Record<string, RecordedTable>> = Object.freeze({\n [DIAGRAM_BOX_AREA.name]: DIAGRAM_BOX_AREA,\n [GIT_BLOB_BYTES.name]: GIT_BLOB_BYTES,\n});\n\n/** This function gives the spec of the family `recorded` that draws from a table. */\nexport function recordedSpec(table: RecordedTable): DistributionSpec {\n return { family: \"recorded\", values: table.quantiles };\n}\n","/**\n * A pseudo-random number generator with a seed, and the draws that tests and benchmarks make from it.\n *\n * The generator is mulberry32. It is fast, it has 32 bits of state and it gives the same sequence for\n * the same seed on each platform. It is not for cryptography. Each repository that copied mulberry32\n * gets the same numbers from `random(seed).next`, so a move to this package keeps the records equal.\n */\n\n/** A source of uniform numbers from 0 (included) to 1 (not included). */\nexport type Source = () => number;\n\n/** The generator mulberry32. The seed is read as a 32-bit unsigned integer. */\nexport function mulberry32(seed: number): Source {\n let state = seed >>> 0;\n return () => {\n state = (state + 0x6d2b79f5) >>> 0;\n let t = state;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nconst UTF8 = new TextEncoder();\n\n/**\n * The FNV-1a hash of 32 bits of a string. The option `input` selects the units that the hash reads:\n *\n * - `\"utf8\"` (the default): the UTF-8 bytes from `TextEncoder`. A lone surrogate becomes the bytes of U+FFFD.\n * - `\"utf16\"`: the UTF-16 code units of the string, one unit for each step, from `charCodeAt`.\n * - `\"wtf8\"`: the UTF-8 bytes of each code point. A lone surrogate becomes its own 3 bytes (WTF-8).\n *\n * For a string without a lone surrogate, `\"utf8\"` and `\"wtf8\"` give the same hash.\n */\nexport function fnv1a32(text: string, options?: { readonly input?: \"utf8\" | \"utf16\" | \"wtf8\" }): number {\n const input = options?.input ?? \"utf8\";\n let h = 0x811c9dc5;\n if (input === \"utf16\") {\n for (let i = 0; i < text.length; i++) h = Math.imul(h ^ text.charCodeAt(i), 0x01000193);\n return h >>> 0;\n }\n if (input === \"wtf8\") {\n for (const ch of text) {\n const c = ch.codePointAt(0) as number;\n if (c < 0x80) h = Math.imul(h ^ c, 0x01000193);\n else if (c < 0x800) {\n h = Math.imul(h ^ (0xc0 | (c >> 6)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n } else if (c < 0x10000) {\n h = Math.imul(h ^ (0xe0 | (c >> 12)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 6) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n } else {\n h = Math.imul(h ^ (0xf0 | (c >> 18)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 12) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | ((c >> 6) & 63)), 0x01000193);\n h = Math.imul(h ^ (0x80 | (c & 63)), 0x01000193);\n }\n }\n return h >>> 0;\n }\n if (input !== \"utf8\") throw new RangeError(`fnv1a32: input is \"utf8\", \"utf16\" or \"wtf8\", not ${String(input)}.`);\n for (const b of UTF8.encode(text)) h = Math.imul(h ^ b, 0x01000193) >>> 0;\n return h;\n}\n\n/** The 32-bit seed of a number (its low 32 bits, unsigned) or of a string (its FNV-1a hash). */\nexport function seedOf(seed: number | string): number {\n if (typeof seed === \"string\") return fnv1a32(seed);\n if (!Number.isFinite(seed)) throw new RangeError(`seedOf: a seed is a finite number or a string, not ${seed}.`);\n return seed >>> 0;\n}\n\n/** The seed of the stream with the name `label` under `seed`: the hash of `\"<seed>:<label>\"`. */\nexport function deriveSeed(seed: number, label: string): number {\n return fnv1a32(`${seed}:${label}`);\n}\n\nexport interface Random {\n /** The 32-bit seed that the generator started with. Write it in each failure message, so a run can replay. */\n readonly seed: number;\n /** A uniform number from 0 (included) to 1 (not included). */\n next(): number;\n /** A uniform integer from `min` to `max`, both included. */\n int(min: number, max: number): number;\n /** A uniform integer from 0 (included) to `n` (not included). */\n below(n: number): number;\n /** A uniform number from `min` (included) to `max` (not included). */\n range(min: number, max: number): number;\n /** `true` with the probability `p`. */\n chance(p: number): boolean;\n /** One item of a list that is not empty, each with the same probability. */\n pick<T>(items: readonly T[]): T;\n /** The index of a weight, with a probability in proportion to the weight. One draw. */\n weighted(weights: readonly number[]): number;\n /** A new list with the items in a uniform random order (Fisher–Yates, from the end). */\n shuffle<T>(items: readonly T[]): T[];\n /** `k` different items of a list, in the order of the draw (a partial Fisher–Yates). */\n sample<T>(items: readonly T[], k: number): T[];\n /** A normal sample (Box–Muller, two draws). */\n normal(mean?: number, sd?: number): number;\n /** An independent generator for the part of the work with the name `label`. The same labels give the same streams. */\n fork(label: string): Random;\n}\n\nfunction wholeOrThrow(name: string, value: number): void {\n if (!Number.isSafeInteger(value)) throw new RangeError(`${name}: ${value} is not a safe integer.`);\n}\n\n/** A generator with draws, from a seed. The default source is mulberry32. */\nexport function random(seed: number | string, source: (seed: number) => Source = mulberry32): Random {\n const start = seedOf(seed);\n return randomOf(source(start), start, source);\n}\n\n/** A generator with draws, from a source that you give. `fork` uses `source` for the new streams. */\nexport function randomOf(next: Source, seed: number, source: (seed: number) => Source = mulberry32): Random {\n const below = (n: number): number => {\n wholeOrThrow(\"below\", n);\n if (n < 1) throw new RangeError(`below: n is 1 or more, not ${n}.`);\n return Math.floor(next() * n);\n };\n return {\n seed,\n next,\n int(min, max) {\n wholeOrThrow(\"int\", min);\n wholeOrThrow(\"int\", max);\n if (min > max) throw new RangeError(`int: min ${min} is more than max ${max}.`);\n return min + Math.floor(next() * (max - min + 1));\n },\n below,\n range: (min, max) => min + next() * (max - min),\n chance: (p) => next() < p,\n pick(items) {\n if (items.length === 0) throw new RangeError(\"pick: the list is empty.\");\n return items[below(items.length)] as (typeof items)[number];\n },\n weighted(weights) {\n let total = 0;\n for (const w of weights) {\n if (!(Number.isFinite(w) && w >= 0)) throw new RangeError(`weighted: each weight is finite and 0 or more, not ${w}.`);\n total += w;\n }\n if (!(total > 0)) throw new RangeError(\"weighted: the sum of the weights is 0.\");\n let left = next() * total;\n for (let i = 0; i < weights.length; i++) {\n left -= weights[i] as number;\n if (left < 0) return i;\n }\n // Rounding can leave a small remainder: give the last index with a weight.\n for (let i = weights.length - 1; ; i--) if ((weights[i] as number) > 0) return i;\n },\n shuffle(items) {\n const out = [...items];\n for (let i = out.length - 1; i > 0; i--) {\n const j = below(i + 1);\n [out[i], out[j]] = [out[j] as (typeof out)[number], out[i] as (typeof out)[number]];\n }\n return out;\n },\n sample(items, k) {\n wholeOrThrow(\"sample\", k);\n if (k < 0 || k > items.length) throw new RangeError(`sample: k is from 0 to ${items.length}, not ${k}.`);\n const out = [...items];\n for (let i = 0; i < k; i++) {\n const j = i + below(out.length - i);\n [out[i], out[j]] = [out[j] as (typeof out)[number], out[i] as (typeof out)[number]];\n }\n return out.slice(0, k);\n },\n normal(mean = 0, sd = 1) {\n const u1 = Math.max(next(), 1e-12);\n const u2 = next();\n return mean + sd * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);\n },\n fork(label) {\n const child = deriveSeed(seed, label);\n return randomOf(source(child), child, source);\n },\n };\n}\n\n/**\n * The seeds of a run: the seed in `given` (the text of an environment variable, for example\n * `process.env.SEED`), else the default seeds. An empty text gives the defaults.\n */\nexport function seedsFrom(given: string | undefined, defaults: readonly number[]): number[] {\n if (given === undefined || given.trim() === \"\") return [...defaults];\n const seed = Number(given);\n if (!Number.isSafeInteger(seed)) throw new RangeError(`seedsFrom: a seed is an integer, not ${given}.`);\n return [seed];\n}\n"],"mappings":";;AAiBA,SAAS,QAAQ,QAAgB,MAAc,OAAc,OAAmC,MAAoB;CAClH,MAAM,OAAO,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI;CACnD,KAAK,MAAM,SAAS,MAClB,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,CAAC,MAAM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A0B;GACpF;GACA,OAAO,IAAI,MAAM,GAAG,CAAC;EACvB;EACA,OAAO,OAAO,GAAG,KAAK,GAAG;GACvB,MAAM,KAAK,KAAK,IAAI,KAAK,GAAG,KAAK;GACjC,MAAM,KAAK,KAAK;GAChB,OAAO,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;EAC7E;EACA,KAAK,OAAO;GACV,MAAM,QAAQ,WAAW,MAAM,KAAK;GACpC,OAAO,SAAS,OAAO,KAAK,GAAG,OAAO,MAAM;EAC9C;CACF;AACF;;;;;AAMA,SAAgB,UAAU,OAA2B,UAAuC;CAC1F,IAAI,UAAU,KAAA,KAAa,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,QAAQ;CACnE,MAAM,OAAO,OAAO,KAAK;CACzB,IAAI,CAAC,OAAO,cAAc,IAAI,GAAG,MAAM,IAAI,WAAW,wCAAwC,MAAM,EAAE;CACtG,OAAO,CAAC,IAAI;AACd"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/rigor-generators",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "description": "A seeded random number generator (mulberry32) with the draws that tests and benchmarks make: integers, picks, weights, shuffles, samples, normal values and named streams.",
6
6
  "keywords": [
7
7
  "random",
@@ -27,6 +27,7 @@
27
27
  "license": "MIT",
28
28
  "author": "Mark Russell (https://github.com/mark1russell7)",
29
29
  "type": "module",
30
+ "sideEffects": false,
30
31
  "main": "./build/index.js",
31
32
  "files": [
32
33
  "build"