@fgv/ts-random 5.1.0-19 → 5.1.0-21
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/package.json +6 -6
- package/.rush/temp/chunked-rush-logs/ts-random.build.chunks.jsonl +0 -6
- package/.rush/temp/fba88d771243a88edd09f745ba7194831032f604.tar.log +0 -121
- package/.rush/temp/operation/build/all.log +0 -6
- package/.rush/temp/operation/build/log-chunks.jsonl +0 -6
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/shrinkwrap-deps.json +0 -614
- package/config/jest.config.json +0 -13
- package/config/rig.json +0 -4
- package/config/typedoc.json +0 -7
- package/dist/test/unit/generators.test.js +0 -596
- package/dist/test/unit/generators.test.js.map +0 -1
- package/dist/test/unit/randomSource.test.js +0 -452
- package/dist/test/unit/randomSource.test.js.map +0 -1
- package/docs/Chars/README.md +0 -152
- package/docs/Chars/variables/all.md +0 -9
- package/docs/Chars/variables/alphanumeric.md +0 -9
- package/docs/Chars/variables/base64.md +0 -9
- package/docs/Chars/variables/base64Url.md +0 -9
- package/docs/Chars/variables/base64UrlNoPadding.md +0 -9
- package/docs/Chars/variables/digits.md +0 -9
- package/docs/Chars/variables/hex.md +0 -9
- package/docs/Chars/variables/hexDigits.md +0 -9
- package/docs/Chars/variables/hexDigitsUpper.md +0 -9
- package/docs/Chars/variables/letters.md +0 -9
- package/docs/Chars/variables/lowerCase.md +0 -9
- package/docs/Chars/variables/printable.md +0 -9
- package/docs/Chars/variables/symbols.md +0 -9
- package/docs/Chars/variables/upperCase.md +0 -9
- package/docs/Chars/variables/whitespace.md +0 -9
- package/docs/Generator/README.md +0 -144
- package/docs/Generator/classes/PseudoRandomGenerator.clone.md +0 -17
- package/docs/Generator/classes/PseudoRandomGenerator.create.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.createChild.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.ensureRng.md +0 -25
- package/docs/Generator/classes/PseudoRandomGenerator.getGlobalRng.md +0 -17
- package/docs/Generator/classes/PseudoRandomGenerator.md +0 -258
- package/docs/Generator/classes/PseudoRandomGenerator.nextBoolean.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.nextFloat.md +0 -17
- package/docs/Generator/classes/PseudoRandomGenerator.nextInRange.md +0 -25
- package/docs/Generator/classes/PseudoRandomGenerator.nextInt.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.nextString.md +0 -25
- package/docs/Generator/classes/PseudoRandomGenerator.pickNext.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.pickRandom.md +0 -25
- package/docs/Generator/classes/PseudoRandomGenerator.pickSequence.md +0 -24
- package/docs/Generator/classes/PseudoRandomGenerator.pickSequential.md +0 -25
- package/docs/Generator/classes/PseudoRandomGenerator.rng.md +0 -11
- package/docs/Generator/classes/PseudoRandomGenerator.setGlobalRng.md +0 -24
- package/docs/Generator/classes/SeededRandomSource.clone.md +0 -17
- package/docs/Generator/classes/SeededRandomSource.counter.md +0 -11
- package/docs/Generator/classes/SeededRandomSource.create.md +0 -24
- package/docs/Generator/classes/SeededRandomSource.createChild.md +0 -24
- package/docs/Generator/classes/SeededRandomSource.hashSeed.md +0 -24
- package/docs/Generator/classes/SeededRandomSource.hashStateAndLabel.md +0 -25
- package/docs/Generator/classes/SeededRandomSource.lineage.md +0 -9
- package/docs/Generator/classes/SeededRandomSource.md +0 -187
- package/docs/Generator/classes/SeededRandomSource.mulberryStep.md +0 -24
- package/docs/Generator/classes/SeededRandomSource.next.md +0 -17
- package/docs/Generator/classes/SeededRandomSource.seed.md +0 -9
- package/docs/Generator/interfaces/INextResult.md +0 -61
- package/docs/Generator/interfaces/INextResult.nextState.md +0 -9
- package/docs/Generator/interfaces/INextResult.value.md +0 -9
- package/docs/Generator/interfaces/IPseudoRandomGeneratorCreateParams.global.md +0 -9
- package/docs/Generator/interfaces/IPseudoRandomGeneratorCreateParams.md +0 -78
- package/docs/Generator/interfaces/IPseudoRandomGeneratorCreateParams.seed.md +0 -9
- package/docs/Generator/interfaces/IPseudoRandomGeneratorCreateParams.step.md +0 -9
- package/docs/Generator/interfaces/IRandomSequencePickParams.candidates.md +0 -9
- package/docs/Generator/interfaces/IRandomSequencePickParams.count.md +0 -9
- package/docs/Generator/interfaces/IRandomSequencePickParams.how.md +0 -9
- package/docs/Generator/interfaces/IRandomSequencePickParams.md +0 -79
- package/docs/Generator/interfaces/ISeedPair.md +0 -61
- package/docs/Generator/interfaces/ISeedPair.seed.md +0 -9
- package/docs/Generator/interfaces/ISeedPair.state.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.counter.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.lineage.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.md +0 -112
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.seed.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.state.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceConstructorParams.step.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceCreateParams.md +0 -61
- package/docs/Generator/interfaces/ISeededRandomSourceCreateParams.seed.md +0 -9
- package/docs/Generator/interfaces/ISeededRandomSourceCreateParams.step.md +0 -9
- package/docs/Generator/interfaces/ISequentialPickParams.candidates.md +0 -9
- package/docs/Generator/interfaces/ISequentialPickParams.count.md +0 -9
- package/docs/Generator/interfaces/ISequentialPickParams.how.md +0 -9
- package/docs/Generator/interfaces/ISequentialPickParams.md +0 -79
- package/docs/Generator/type-aliases/RandomStepFunction.md +0 -11
- package/docs/Generator/type-aliases/SequencePickParams.md +0 -11
- package/docs/GeneratorData/Chars/README.md +0 -152
- package/docs/GeneratorData/Chars/variables/all.md +0 -9
- package/docs/GeneratorData/Chars/variables/alphanumeric.md +0 -9
- package/docs/GeneratorData/Chars/variables/base64.md +0 -9
- package/docs/GeneratorData/Chars/variables/base64Url.md +0 -9
- package/docs/GeneratorData/Chars/variables/base64UrlNoPadding.md +0 -9
- package/docs/GeneratorData/Chars/variables/digits.md +0 -9
- package/docs/GeneratorData/Chars/variables/hex.md +0 -9
- package/docs/GeneratorData/Chars/variables/hexDigits.md +0 -9
- package/docs/GeneratorData/Chars/variables/hexDigitsUpper.md +0 -9
- package/docs/GeneratorData/Chars/variables/letters.md +0 -9
- package/docs/GeneratorData/Chars/variables/lowerCase.md +0 -9
- package/docs/GeneratorData/Chars/variables/printable.md +0 -9
- package/docs/GeneratorData/Chars/variables/symbols.md +0 -9
- package/docs/GeneratorData/Chars/variables/upperCase.md +0 -9
- package/docs/GeneratorData/Chars/variables/whitespace.md +0 -9
- package/docs/GeneratorData/README.md +0 -35
- package/docs/GeneratorData/Words/README.md +0 -125
- package/docs/GeneratorData/Words/variables/Adjectives.md +0 -7
- package/docs/GeneratorData/Words/variables/Animals.md +0 -7
- package/docs/GeneratorData/Words/variables/Cities.md +0 -7
- package/docs/GeneratorData/Words/variables/Colors.md +0 -7
- package/docs/GeneratorData/Words/variables/Countries.md +0 -7
- package/docs/GeneratorData/Words/variables/Domains.md +0 -7
- package/docs/GeneratorData/Words/variables/FamilyNames.md +0 -9
- package/docs/GeneratorData/Words/variables/FirstNames.md +0 -9
- package/docs/GeneratorData/Words/variables/FirstNamesFemale.md +0 -9
- package/docs/GeneratorData/Words/variables/FirstNamesMale.md +0 -9
- package/docs/GeneratorData/Words/variables/Gerunds.md +0 -7
- package/docs/GeneratorData/Words/variables/jobs.md +0 -7
- package/docs/GeneratorData/variables/Adjectives.md +0 -7
- package/docs/GeneratorData/variables/Animals.md +0 -7
- package/docs/GeneratorData/variables/Cities.md +0 -7
- package/docs/GeneratorData/variables/Colors.md +0 -7
- package/docs/GeneratorData/variables/Countries.md +0 -7
- package/docs/GeneratorData/variables/Domains.md +0 -7
- package/docs/GeneratorData/variables/FamilyNames.md +0 -9
- package/docs/GeneratorData/variables/FirstNames.md +0 -9
- package/docs/GeneratorData/variables/FirstNamesFemale.md +0 -9
- package/docs/GeneratorData/variables/FirstNamesMale.md +0 -9
- package/docs/GeneratorData/variables/Gerunds.md +0 -7
- package/docs/GeneratorData/variables/all.md +0 -9
- package/docs/GeneratorData/variables/alphanumeric.md +0 -9
- package/docs/GeneratorData/variables/base64.md +0 -9
- package/docs/GeneratorData/variables/base64Url.md +0 -9
- package/docs/GeneratorData/variables/base64UrlNoPadding.md +0 -9
- package/docs/GeneratorData/variables/digits.md +0 -9
- package/docs/GeneratorData/variables/hex.md +0 -9
- package/docs/GeneratorData/variables/hexDigits.md +0 -9
- package/docs/GeneratorData/variables/hexDigitsUpper.md +0 -9
- package/docs/GeneratorData/variables/jobs.md +0 -7
- package/docs/GeneratorData/variables/letters.md +0 -9
- package/docs/GeneratorData/variables/lowerCase.md +0 -9
- package/docs/GeneratorData/variables/printable.md +0 -9
- package/docs/GeneratorData/variables/symbols.md +0 -9
- package/docs/GeneratorData/variables/upperCase.md +0 -9
- package/docs/GeneratorData/variables/whitespace.md +0 -9
- package/docs/README.md +0 -35
- package/docs/Words/README.md +0 -125
- package/docs/Words/variables/Adjectives.md +0 -7
- package/docs/Words/variables/Animals.md +0 -7
- package/docs/Words/variables/Cities.md +0 -7
- package/docs/Words/variables/Colors.md +0 -7
- package/docs/Words/variables/Countries.md +0 -7
- package/docs/Words/variables/Domains.md +0 -7
- package/docs/Words/variables/FamilyNames.md +0 -9
- package/docs/Words/variables/FirstNames.md +0 -9
- package/docs/Words/variables/FirstNamesFemale.md +0 -9
- package/docs/Words/variables/FirstNamesMale.md +0 -9
- package/docs/Words/variables/Gerunds.md +0 -7
- package/docs/Words/variables/jobs.md +0 -7
- package/docs/classes/PseudoRandomGenerator.clone.md +0 -17
- package/docs/classes/PseudoRandomGenerator.create.md +0 -24
- package/docs/classes/PseudoRandomGenerator.createChild.md +0 -24
- package/docs/classes/PseudoRandomGenerator.ensureRng.md +0 -25
- package/docs/classes/PseudoRandomGenerator.getGlobalRng.md +0 -17
- package/docs/classes/PseudoRandomGenerator.md +0 -258
- package/docs/classes/PseudoRandomGenerator.nextBoolean.md +0 -24
- package/docs/classes/PseudoRandomGenerator.nextFloat.md +0 -17
- package/docs/classes/PseudoRandomGenerator.nextInRange.md +0 -25
- package/docs/classes/PseudoRandomGenerator.nextInt.md +0 -24
- package/docs/classes/PseudoRandomGenerator.nextString.md +0 -25
- package/docs/classes/PseudoRandomGenerator.pickNext.md +0 -24
- package/docs/classes/PseudoRandomGenerator.pickRandom.md +0 -25
- package/docs/classes/PseudoRandomGenerator.pickSequence.md +0 -24
- package/docs/classes/PseudoRandomGenerator.pickSequential.md +0 -25
- package/docs/classes/PseudoRandomGenerator.rng.md +0 -11
- package/docs/classes/PseudoRandomGenerator.setGlobalRng.md +0 -24
- package/docs/classes/SeededRandomSource.clone.md +0 -17
- package/docs/classes/SeededRandomSource.counter.md +0 -11
- package/docs/classes/SeededRandomSource.create.md +0 -24
- package/docs/classes/SeededRandomSource.createChild.md +0 -24
- package/docs/classes/SeededRandomSource.hashSeed.md +0 -24
- package/docs/classes/SeededRandomSource.hashStateAndLabel.md +0 -25
- package/docs/classes/SeededRandomSource.lineage.md +0 -9
- package/docs/classes/SeededRandomSource.md +0 -187
- package/docs/classes/SeededRandomSource.mulberryStep.md +0 -24
- package/docs/classes/SeededRandomSource.next.md +0 -17
- package/docs/classes/SeededRandomSource.seed.md +0 -9
- package/docs/interfaces/INextResult.md +0 -61
- package/docs/interfaces/INextResult.nextState.md +0 -9
- package/docs/interfaces/INextResult.value.md +0 -9
- package/docs/interfaces/IPseudoRandomGeneratorCreateParams.global.md +0 -9
- package/docs/interfaces/IPseudoRandomGeneratorCreateParams.md +0 -78
- package/docs/interfaces/IPseudoRandomGeneratorCreateParams.seed.md +0 -9
- package/docs/interfaces/IPseudoRandomGeneratorCreateParams.step.md +0 -9
- package/docs/interfaces/IRandomSequencePickParams.candidates.md +0 -9
- package/docs/interfaces/IRandomSequencePickParams.count.md +0 -9
- package/docs/interfaces/IRandomSequencePickParams.how.md +0 -9
- package/docs/interfaces/IRandomSequencePickParams.md +0 -79
- package/docs/interfaces/ISeedPair.md +0 -61
- package/docs/interfaces/ISeedPair.seed.md +0 -9
- package/docs/interfaces/ISeedPair.state.md +0 -9
- package/docs/interfaces/ISeededRandomSourceConstructorParams.counter.md +0 -9
- package/docs/interfaces/ISeededRandomSourceConstructorParams.lineage.md +0 -9
- package/docs/interfaces/ISeededRandomSourceConstructorParams.md +0 -112
- package/docs/interfaces/ISeededRandomSourceConstructorParams.seed.md +0 -9
- package/docs/interfaces/ISeededRandomSourceConstructorParams.state.md +0 -9
- package/docs/interfaces/ISeededRandomSourceConstructorParams.step.md +0 -9
- package/docs/interfaces/ISeededRandomSourceCreateParams.md +0 -61
- package/docs/interfaces/ISeededRandomSourceCreateParams.seed.md +0 -9
- package/docs/interfaces/ISeededRandomSourceCreateParams.step.md +0 -9
- package/docs/interfaces/ISequentialPickParams.candidates.md +0 -9
- package/docs/interfaces/ISequentialPickParams.count.md +0 -9
- package/docs/interfaces/ISequentialPickParams.how.md +0 -9
- package/docs/interfaces/ISequentialPickParams.md +0 -79
- package/docs/type-aliases/RandomStepFunction.md +0 -11
- package/docs/type-aliases/SequencePickParams.md +0 -11
- package/docs/variables/Adjectives.md +0 -7
- package/docs/variables/Animals.md +0 -7
- package/docs/variables/Cities.md +0 -7
- package/docs/variables/Colors.md +0 -7
- package/docs/variables/Countries.md +0 -7
- package/docs/variables/Domains.md +0 -7
- package/docs/variables/FamilyNames.md +0 -9
- package/docs/variables/FirstNames.md +0 -9
- package/docs/variables/FirstNamesFemale.md +0 -9
- package/docs/variables/FirstNamesMale.md +0 -9
- package/docs/variables/Gerunds.md +0 -7
- package/docs/variables/all.md +0 -9
- package/docs/variables/alphanumeric.md +0 -9
- package/docs/variables/base64.md +0 -9
- package/docs/variables/base64Url.md +0 -9
- package/docs/variables/base64UrlNoPadding.md +0 -9
- package/docs/variables/digits.md +0 -9
- package/docs/variables/hex.md +0 -9
- package/docs/variables/hexDigits.md +0 -9
- package/docs/variables/hexDigitsUpper.md +0 -9
- package/docs/variables/jobs.md +0 -7
- package/docs/variables/letters.md +0 -9
- package/docs/variables/lowerCase.md +0 -9
- package/docs/variables/printable.md +0 -9
- package/docs/variables/symbols.md +0 -9
- package/docs/variables/upperCase.md +0 -9
- package/docs/variables/whitespace.md +0 -9
- package/lib/test/unit/generators.test.d.ts +0 -2
- package/lib/test/unit/generators.test.d.ts.map +0 -1
- package/lib/test/unit/generators.test.js +0 -598
- package/lib/test/unit/generators.test.js.map +0 -1
- package/lib/test/unit/randomSource.test.d.ts +0 -2
- package/lib/test/unit/randomSource.test.d.ts.map +0 -1
- package/lib/test/unit/randomSource.test.js +0 -454
- package/lib/test/unit/randomSource.test.js.map +0 -1
- package/rush-logs/ts-random.build.cache.log +0 -3
- package/rush-logs/ts-random.build.log +0 -6
- package/src/generator/generators.ts +0 -273
- package/src/generator/index.ts +0 -22
- package/src/generator/randomSource.ts +0 -224
- package/src/generator-data/charClasses.ts +0 -95
- package/src/generator-data/index.ts +0 -22
- package/src/generator-data/words/adjectives.ts +0 -247
- package/src/generator-data/words/animals.ts +0 -75
- package/src/generator-data/words/cities.ts +0 -229
- package/src/generator-data/words/colors.ts +0 -56
- package/src/generator-data/words/countries.ts +0 -217
- package/src/generator-data/words/domains.ts +0 -47
- package/src/generator-data/words/gerunds.ts +0 -126
- package/src/generator-data/words/index.ts +0 -29
- package/src/generator-data/words/jobs.ts +0 -175
- package/src/generator-data/words/names.ts +0 -717
- package/src/index.ts +0 -7
- package/src/test/unit/generators.test.ts +0 -697
- package/src/test/unit/randomSource.test.ts +0 -526
- package/temp/build/typescript/ts_8nwakTlr.json +0 -1
- package/tsconfig.json +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"randomSource.test.js","sourceRoot":"","sources":["../../../src/test/unit/randomSource.test.ts"],"names":[],"mappings":";;AAAA,8BAA4B;AAE5B,+CAAyE;AAEzE;;;GAGG;AACH,MAAM,eAAe,G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L,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;YAC1D,MAAM,CAAC,8BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,EAAE;gBACrE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,8BAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACjC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import '@fgv/ts-utils-jest';\n\nimport { RandomStepFunction, SeededRandomSource } from '../../generator';\n\n/**\n * A passthrough step function useful for testing: returns the state as the value\n * and increments the state by 1 each step, making sequences predictable.\n */\nconst passthroughStep: RandomStepFunction = (state: number) => {\n return {\n value: state,\n nextState: state + 1\n };\n};\n\nfunction createSource(seed: number | string): SeededRandomSource {\n return SeededRandomSource.create(seed).orThrow();\n}\n\nfunction readValues(source: SeededRandomSource, count: number): number[] {\n const values: number[] = [];\n for (let index = 0; index < count; index += 1) {\n values.push(source.next());\n }\n return values;\n}\n\ndescribe('SeededRandomSource', () => {\n describe('create', () => {\n test('succeeds with a numeric seed', () => {\n expect(SeededRandomSource.create(42)).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('42');\n expect(source.counter).toBe(0);\n expect(source.lineage).toEqual([]);\n });\n });\n\n test('succeeds with a string seed', () => {\n expect(SeededRandomSource.create('hello')).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('hello');\n expect(source.counter).toBe(0);\n expect(source.lineage).toEqual([]);\n });\n });\n\n test('succeeds with no seed using Date.now as fallback', () => {\n const nowSpy = jest.spyOn(Date, 'now').mockReturnValue(999);\n try {\n expect(SeededRandomSource.create()).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('999');\n expect(source.counter).toBe(0);\n });\n } finally {\n nowSpy.mockRestore();\n }\n });\n\n test('unseeded sources created at different times produce different sequences', () => {\n const nowSpy = jest.spyOn(Date, 'now');\n nowSpy.mockReturnValueOnce(100);\n nowSpy.mockReturnValueOnce(200);\n try {\n const first = SeededRandomSource.create().orThrow();\n const second = SeededRandomSource.create().orThrow();\n expect(readValues(first, 4)).not.toEqual(readValues(second, 4));\n } finally {\n nowSpy.mockRestore();\n }\n });\n\n test('object-form initialization behaves like primitive initialization', () => {\n const primitive = createSource(12345);\n const object = SeededRandomSource.create({ seed: 12345 }).orThrow();\n expect(readValues(primitive, 4)).toEqual(readValues(object, 4));\n });\n\n test('object-form with custom step function uses that step', () => {\n expect(SeededRandomSource.create({ seed: 10, step: passthroughStep })).toSucceedAndSatisfy((source) => {\n expect(source.next()).toBe(10);\n expect(source.next()).toBe(11);\n expect(source.next()).toBe(12);\n });\n });\n\n test('object-form without seed falls back to Date.now', () => {\n const nowSpy = jest.spyOn(Date, 'now').mockReturnValue(555);\n try {\n expect(SeededRandomSource.create({ step: passthroughStep })).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('555');\n expect(source.next()).toBe(555);\n });\n } finally {\n nowSpy.mockRestore();\n }\n });\n });\n\n describe('deterministic sequences', () => {\n test('same seed always produces the same sequence', () => {\n const first = createSource('deterministic');\n const second = createSource('deterministic');\n expect(readValues(first, 10)).toEqual(readValues(second, 10));\n });\n\n test('numeric and string forms of the same seed produce identical sequences', () => {\n const numeric = createSource(12345);\n const stringForm = createSource('12345');\n expect(readValues(numeric, 10)).toEqual(readValues(stringForm, 10));\n });\n\n test('different seeds produce different sequences', () => {\n const first = createSource('alpha');\n const second = createSource('beta');\n expect(readValues(first, 4)).not.toEqual(readValues(second, 4));\n });\n });\n\n describe('next', () => {\n test('counter increments with each call', () => {\n const source = createSource(1);\n expect(source.counter).toBe(0);\n source.next();\n expect(source.counter).toBe(1);\n source.next();\n source.next();\n expect(source.counter).toBe(3);\n });\n\n test('returns values in [0, 1) range over many iterations', () => {\n const source = createSource(42);\n for (let i = 0; i < 1000; i++) {\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n }\n });\n\n test('sequence does not degenerate to constant values', () => {\n const source = createSource(42);\n const values = readValues(source, 100);\n const unique = new Set(values);\n // With 100 values from a proper PRNG, we expect many unique values\n expect(unique.size).toBeGreaterThan(90);\n });\n });\n\n describe('clone', () => {\n test('clone produces identical sequence from clone point', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n\n const clone = parent.clone();\n expect(readValues(parent, 4)).toEqual(readValues(clone, 4));\n });\n\n test('clone preserves counter and lineage', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n parent.next();\n\n const clone = parent.clone();\n expect(clone.counter).toBe(3);\n expect(clone.seed).toBe(parent.seed);\n expect(clone.lineage).toEqual(parent.lineage);\n });\n\n test('advancing clone does not affect parent', () => {\n const parent = createSource(7);\n parent.next();\n\n const clone = parent.clone();\n clone.next();\n clone.next();\n clone.next();\n\n // Parent should still be at counter 1 and produce its own next value\n expect(parent.counter).toBe(1);\n expect(clone.counter).toBe(4);\n\n // Parent's next value should differ from clone's (different positions)\n parent.next();\n clone.next();\n expect(parent.counter).toBe(2);\n expect(clone.counter).toBe(5);\n });\n\n test('clone of a child preserves child lineage', () => {\n const parent = createSource(7);\n parent.next();\n const child = parent.createChild('branch');\n child.next();\n child.next();\n\n const clone = child.clone();\n expect(clone.lineage).toEqual(['1:branch']);\n expect(clone.counter).toBe(2);\n expect(readValues(child, 4)).toEqual(readValues(clone, 4));\n });\n });\n\n describe('createChild', () => {\n test('child starts with counter at 0', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n\n const child = parent.createChild('test');\n expect(child.counter).toBe(0);\n });\n\n test('child records lineage as counter:label', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n parent.next();\n\n const child = parent.createChild('myLabel');\n expect(child.lineage).toEqual(['3:myLabel']);\n });\n\n test('grandchild accumulates lineage', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n\n const child = parent.createChild('branch');\n child.next();\n\n const grandchild = child.createChild('leaf');\n expect(grandchild.lineage).toEqual(['2:branch', '1:leaf']);\n expect(grandchild.counter).toBe(0);\n });\n\n test('children with same label from same parent state are identical', () => {\n const parent1 = createSource(7);\n const parent2 = createSource(7);\n parent1.next();\n parent1.next();\n parent2.next();\n parent2.next();\n\n const child1 = parent1.createChild('same');\n const child2 = parent2.createChild('same');\n expect(readValues(child1, 10)).toEqual(readValues(child2, 10));\n });\n\n test('children with different labels produce different sequences', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n\n const childA = parent.createChild('alpha');\n const childB = parent.createChild('beta');\n expect(readValues(childA, 4)).not.toEqual(readValues(childB, 4));\n });\n\n test('same label but different parent positions produce different children', () => {\n const early = createSource(7);\n const later = createSource(7);\n early.next();\n later.next();\n later.next();\n\n const earlyChild = early.createChild('shared');\n const laterChild = later.createChild('shared');\n expect(readValues(earlyChild, 4)).not.toEqual(readValues(laterChild, 4));\n });\n\n test('advancing child does not affect parent', () => {\n const parent = createSource(7);\n parent.next();\n parent.next();\n\n const child = parent.createChild('test');\n child.next();\n child.next();\n child.next();\n\n expect(parent.counter).toBe(2);\n expect(child.counter).toBe(3);\n });\n\n test('child uses same step function as parent', () => {\n const parent = SeededRandomSource.create({ seed: 10, step: passthroughStep }).orThrow();\n parent.next(); // advances state to 11\n\n const child = parent.createChild('x');\n // Child should use passthroughStep too. Its initial state comes from hashStateAndLabel\n // so value = hashed state, next call returns hashed state + 1\n const first = child.next();\n const second = child.next();\n expect(second - first).toBe(1); // passthroughStep increments by 1\n });\n\n test('child with empty label produces a valid source', () => {\n const parent = createSource(7);\n parent.next();\n\n const child = parent.createChild('');\n expect(child.lineage).toEqual(['1:']);\n expect(child.counter).toBe(0);\n // Should still produce valid numbers\n const value = child.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n describe('hashSeed', () => {\n test('numeric input returns number as string seed and number as state', () => {\n const result = SeededRandomSource.hashSeed(42);\n expect(result).toEqual({ seed: '42', state: 42 });\n });\n\n test('numeric zero is handled correctly', () => {\n const result = SeededRandomSource.hashSeed(0);\n expect(result).toEqual({ seed: '0', state: 0 });\n });\n\n test('negative number is handled correctly', () => {\n const result = SeededRandomSource.hashSeed(-5);\n expect(result).toEqual({ seed: '-5', state: -5 });\n });\n\n test('string that parses as number uses numeric state', () => {\n const result = SeededRandomSource.hashSeed('123');\n expect(result).toEqual({ seed: '123', state: 123 });\n });\n\n test('string \"0\" parses as numeric zero', () => {\n const result = SeededRandomSource.hashSeed('0');\n expect(result).toEqual({ seed: '0', state: 0 });\n });\n\n test('non-numeric string is hashed to a state', () => {\n const result = SeededRandomSource.hashSeed('hello');\n expect(result.seed).toBe('hello');\n expect(typeof result.state).toBe('number');\n expect(result.state).toBeGreaterThanOrEqual(0);\n });\n\n test('same non-numeric string always produces same hash', () => {\n const first = SeededRandomSource.hashSeed('test-seed');\n const second = SeededRandomSource.hashSeed('test-seed');\n expect(first).toEqual(second);\n });\n\n test('different non-numeric strings produce different hashes', () => {\n const a = SeededRandomSource.hashSeed('alpha');\n const b = SeededRandomSource.hashSeed('beta');\n expect(a.state).not.toBe(b.state);\n });\n\n test('empty string is hashed (not treated as numeric)', () => {\n const result = SeededRandomSource.hashSeed('');\n expect(result.seed).toBe('');\n // Empty string: Number('') is 0, isFinite(0) is true, so state should be 0\n expect(result.state).toBe(0);\n });\n\n test('string \"Infinity\" is hashed as non-numeric', () => {\n const result = SeededRandomSource.hashSeed('Infinity');\n expect(result.seed).toBe('Infinity');\n // Number('Infinity') is Infinity, isFinite(Infinity) is false → hashed\n expect(typeof result.state).toBe('number');\n expect(result.state).not.toBe(Infinity);\n });\n\n test('string \"NaN\" is hashed as non-numeric', () => {\n const result = SeededRandomSource.hashSeed('NaN');\n expect(result.seed).toBe('NaN');\n // Number('NaN') is NaN, isNaN(NaN) is true → hashed\n expect(typeof result.state).toBe('number');\n expect(isNaN(result.state)).toBe(false);\n });\n\n test('floating point string is treated as numeric', () => {\n const result = SeededRandomSource.hashSeed('3.14');\n expect(result).toEqual({ seed: '3.14', state: 3.14 });\n });\n\n test('negative numeric string is treated as numeric', () => {\n const result = SeededRandomSource.hashSeed('-42');\n expect(result).toEqual({ seed: '-42', state: -42 });\n });\n });\n\n describe('hashStateAndLabel', () => {\n test('produces a seed string in \"state:label\" format', () => {\n const result = SeededRandomSource.hashStateAndLabel(100, 'test');\n expect(result.seed).toBe('100:test');\n });\n\n test('state is treated as unsigned 32-bit integer in seed string', () => {\n // -1 >>> 0 = 4294967295\n const result = SeededRandomSource.hashStateAndLabel(-1, 'label');\n expect(result.seed).toBe('4294967295:label');\n });\n\n test('same inputs produce same output', () => {\n const first = SeededRandomSource.hashStateAndLabel(42, 'branch');\n const second = SeededRandomSource.hashStateAndLabel(42, 'branch');\n expect(first).toEqual(second);\n });\n\n test('different states produce different results', () => {\n const a = SeededRandomSource.hashStateAndLabel(1, 'same');\n const b = SeededRandomSource.hashStateAndLabel(2, 'same');\n expect(a.state).not.toBe(b.state);\n });\n\n test('different labels produce different results', () => {\n const a = SeededRandomSource.hashStateAndLabel(42, 'alpha');\n const b = SeededRandomSource.hashStateAndLabel(42, 'beta');\n expect(a.state).not.toBe(b.state);\n });\n\n test('state value is a non-negative number from hash', () => {\n const result = SeededRandomSource.hashStateAndLabel(999, 'test');\n expect(result.state).toBeGreaterThanOrEqual(0);\n });\n });\n\n describe('mulberryStep', () => {\n test('returns value in [0, 1) range', () => {\n const result = SeededRandomSource.mulberryStep(42);\n expect(result.value).toBeGreaterThanOrEqual(0);\n expect(result.value).toBeLessThan(1);\n });\n\n test('advances state deterministically', () => {\n const first = SeededRandomSource.mulberryStep(42);\n const second = SeededRandomSource.mulberryStep(42);\n expect(first).toEqual(second);\n });\n\n test('different states produce different results', () => {\n const a = SeededRandomSource.mulberryStep(1);\n const b = SeededRandomSource.mulberryStep(2);\n expect(a.value).not.toBe(b.value);\n expect(a.nextState).not.toBe(b.nextState);\n });\n\n test('nextState is an unsigned 32-bit integer', () => {\n const result = SeededRandomSource.mulberryStep(0);\n expect(result.nextState).toBeGreaterThanOrEqual(0);\n expect(result.nextState).toBeLessThanOrEqual(0xffffffff);\n expect(Number.isInteger(result.nextState)).toBe(true);\n });\n\n test('state 0 produces valid output', () => {\n const result = SeededRandomSource.mulberryStep(0);\n expect(result.value).toBeGreaterThanOrEqual(0);\n expect(result.value).toBeLessThan(1);\n // nextState should be 0x6D2B79F5 (the constant added)\n expect(result.nextState).toBe(0x6d2b79f5);\n });\n\n test('produces [0,1) values across many states', () => {\n let state = 12345;\n for (let i = 0; i < 1000; i++) {\n const result = SeededRandomSource.mulberryStep(state);\n expect(result.value).toBeGreaterThanOrEqual(0);\n expect(result.value).toBeLessThan(1);\n state = result.nextState;\n }\n });\n });\n\n describe('seed edge cases', () => {\n test('seed 0 produces a valid source', () => {\n expect(SeededRandomSource.create(0)).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('0');\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n test('negative seed produces a valid source', () => {\n expect(SeededRandomSource.create(-1)).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('-1');\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n test('very large numeric seed produces a valid source', () => {\n expect(SeededRandomSource.create(Number.MAX_SAFE_INTEGER)).toSucceedAndSatisfy((source) => {\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n test('empty string seed produces a valid source', () => {\n expect(SeededRandomSource.create('')).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('');\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n test('whitespace string seed produces a valid source', () => {\n expect(SeededRandomSource.create(' ')).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe(' ');\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n\n test('unicode string seed produces a valid source', () => {\n expect(SeededRandomSource.create('🎲🎰')).toSucceedAndSatisfy((source) => {\n expect(source.seed).toBe('🎲🎰');\n const value = source.next();\n expect(value).toBeGreaterThanOrEqual(0);\n expect(value).toBeLessThan(1);\n });\n });\n });\n});\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
Invoking: heft build --clean
|
|
2
|
-
---- build started ----
|
|
3
|
-
[build:typescript] The TypeScript compiler version 5.9.3 is newer than the latest version that was tested with Heft (5.8); it may not work correctly.
|
|
4
|
-
[build:typescript] Using TypeScript version 5.9.3
|
|
5
|
-
---- build finished (7.511s) ----
|
|
6
|
-
-------------------- Finished (7.516s) --------------------
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Erik Fortune
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
// copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
// SOFTWARE.
|
|
20
|
-
|
|
21
|
-
import { captureResult, Result, Success } from '@fgv/ts-utils';
|
|
22
|
-
import { RandomStepFunction, SeededRandomSource } from './randomSource';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Parameters for creating a generator.
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export interface IPseudoRandomGeneratorCreateParams {
|
|
29
|
-
seed?: number | string;
|
|
30
|
-
step?: RandomStepFunction;
|
|
31
|
-
global?: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Parameters for generating a sequence of values
|
|
36
|
-
* from each dictionary in a supplied set, in turn.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export interface ISequentialPickParams<T> {
|
|
40
|
-
how: 'sequence';
|
|
41
|
-
count?: number;
|
|
42
|
-
candidates: ReadonlyArray<ReadonlyArray<T>>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Parameters for generating a sequence of values
|
|
47
|
-
* by randomly selecting from dictionaries in a supplied set.
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface IRandomSequencePickParams<T> {
|
|
51
|
-
how: 'random';
|
|
52
|
-
count: number;
|
|
53
|
-
candidates: ReadonlyArray<ReadonlyArray<T>>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Type representing parameters for generating a sequence of values.
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
60
|
-
export type SequencePickParams<T> = ISequentialPickParams<T> | IRandomSequencePickParams<T>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A pseudo-random number generator that can be used to generate random values
|
|
64
|
-
* of various shapes.
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
export class PseudoRandomGenerator {
|
|
68
|
-
private static _globalRng: PseudoRandomGenerator | undefined;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The underlying random number generator.
|
|
72
|
-
*/
|
|
73
|
-
public readonly rng: SeededRandomSource;
|
|
74
|
-
|
|
75
|
-
private constructor(rng: SeededRandomSource) {
|
|
76
|
-
this.rng = rng;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Creates a new pseudo-random number generator.
|
|
81
|
-
* @param params - The parameters for creating the generator.
|
|
82
|
-
* @returns A result containing the new generator or an error.
|
|
83
|
-
*/
|
|
84
|
-
public static create(params: IPseudoRandomGeneratorCreateParams = {}): Result<PseudoRandomGenerator> {
|
|
85
|
-
return SeededRandomSource.create(params)
|
|
86
|
-
.onSuccess((rng) => captureResult(() => new PseudoRandomGenerator(rng)))
|
|
87
|
-
.onSuccess((generator) => {
|
|
88
|
-
if (params?.global === true) {
|
|
89
|
-
PseudoRandomGenerator.setGlobalRng(generator);
|
|
90
|
-
}
|
|
91
|
-
return Success.with(generator);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Creates a clone of this generator.
|
|
97
|
-
* @returns A new generator with the same state.
|
|
98
|
-
*/
|
|
99
|
-
public clone(): PseudoRandomGenerator {
|
|
100
|
-
return new PseudoRandomGenerator(this.rng.clone());
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Creates a child generator with the given label.
|
|
105
|
-
* @param label - The label for the child generator.
|
|
106
|
-
* @returns A new generator with the given label.
|
|
107
|
-
*/
|
|
108
|
-
public createChild(label: string): PseudoRandomGenerator {
|
|
109
|
-
return new PseudoRandomGenerator(this.rng.createChild(label));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Generates a random float between 0 and 1.
|
|
114
|
-
* @returns A random float between 0 and 1.
|
|
115
|
-
*/
|
|
116
|
-
public nextFloat(): number {
|
|
117
|
-
return this.rng.next();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Generates a random integer between 0 and the specified extent (positive or negative).
|
|
122
|
-
* @param extent - The maximum (or minimum) value (exclusive).
|
|
123
|
-
* @returns A random integer between 0 and the specified extent.
|
|
124
|
-
*/
|
|
125
|
-
public nextInt(extent?: number): number {
|
|
126
|
-
if (extent !== undefined && Number.isFinite(extent)) {
|
|
127
|
-
if (extent < 0) {
|
|
128
|
-
return Math.ceil(this.rng.next() * extent);
|
|
129
|
-
}
|
|
130
|
-
return Math.floor(this.rng.next() * extent);
|
|
131
|
-
}
|
|
132
|
-
return Math.floor(this.rng.next() * Number.MAX_SAFE_INTEGER);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Generates a random integer between the specified minimum and maximum values.
|
|
137
|
-
* @param min - The minimum value (inclusive).
|
|
138
|
-
* @param max - The maximum value (inclusive).
|
|
139
|
-
* @returns A random integer between the specified minimum and maximum values.
|
|
140
|
-
* @remarks If min is greater than max, the values are swapped.
|
|
141
|
-
*/
|
|
142
|
-
public nextInRange(min: number | undefined, max: number | undefined): number {
|
|
143
|
-
min = min ?? 0;
|
|
144
|
-
max = max ?? Number.MAX_SAFE_INTEGER;
|
|
145
|
-
if (min > max) {
|
|
146
|
-
return Math.ceil(this.rng.next() * (min - max - 1)) + max;
|
|
147
|
-
}
|
|
148
|
-
return Math.floor(this.rng.next() * (max - min + 1)) + min;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Generates a random boolean value.
|
|
153
|
-
* @param trueProbability - The probability of returning true (default is 0.5).
|
|
154
|
-
* @returns A random boolean value.
|
|
155
|
-
*/
|
|
156
|
-
public nextBoolean(trueProbability: number = 0.5): boolean {
|
|
157
|
-
return this.rng.next() < trueProbability;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Generates a random string of the specified length using the given characters.
|
|
162
|
-
* @param length - The length of the string to generate.
|
|
163
|
-
* @param chars - The characters to use for the string (default is alphanumeric).
|
|
164
|
-
* @returns A random string of the specified length.
|
|
165
|
-
*/
|
|
166
|
-
public nextString(
|
|
167
|
-
length: number,
|
|
168
|
-
chars: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
169
|
-
): string {
|
|
170
|
-
let result = '';
|
|
171
|
-
for (let i = 0; i < length; i++) {
|
|
172
|
-
result += chars[this.nextInt(chars.length)];
|
|
173
|
-
}
|
|
174
|
-
return result;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Generates a random item from the given array.
|
|
179
|
-
* @param items - The array to select from.
|
|
180
|
-
* @returns A random item from the array or undefined if the array is empty.
|
|
181
|
-
*/
|
|
182
|
-
public pickNext<T>(items?: ReadonlyArray<T>): T | undefined {
|
|
183
|
-
if (items === undefined || items.length === 0) {
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
return items[this.nextInt(items.length)];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Generates a sequence of values by randomly selecting from the given candidate
|
|
191
|
-
* dictionaries in order.
|
|
192
|
-
* @param params - The parameters for generating the sequence.
|
|
193
|
-
* @returns A sequence of values.
|
|
194
|
-
*/
|
|
195
|
-
public pickSequential<T>(params: ISequentialPickParams<T>): ReadonlyArray<T> {
|
|
196
|
-
const count = params.count ?? params.candidates.length;
|
|
197
|
-
const items: T[] = [];
|
|
198
|
-
|
|
199
|
-
for (let i = 0; i < count; i++) {
|
|
200
|
-
const dIndex = i % params.candidates.length;
|
|
201
|
-
const item = this.pickNext(params.candidates[dIndex]);
|
|
202
|
-
if (item !== undefined) {
|
|
203
|
-
items.push(item);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return items;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Generates a sequence of values by randomly selecting from the supplied
|
|
212
|
-
* dictionaries in random order.
|
|
213
|
-
* @param params - The parameters for generating the sequence.
|
|
214
|
-
* @returns A sequence of values.
|
|
215
|
-
*/
|
|
216
|
-
public pickRandom<T>(params: IRandomSequencePickParams<T>): ReadonlyArray<T> {
|
|
217
|
-
const items: T[] = [];
|
|
218
|
-
|
|
219
|
-
for (let i = 0; i < params.count; i++) {
|
|
220
|
-
const dIndex = this.nextInt(params.candidates.length);
|
|
221
|
-
const item = this.pickNext(params.candidates[dIndex]);
|
|
222
|
-
if (item !== undefined) {
|
|
223
|
-
items.push(item);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return items;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Generates a sequence of values by randomly selecting from the given candidates.
|
|
232
|
-
* @param params - The parameters for generating the sequence.
|
|
233
|
-
* @returns A sequence of values.
|
|
234
|
-
*/
|
|
235
|
-
public pickSequence<T>(params: SequencePickParams<T>): ReadonlyArray<T> {
|
|
236
|
-
if (params.how === 'sequence') {
|
|
237
|
-
return this.pickSequential(params);
|
|
238
|
-
} else {
|
|
239
|
-
return this.pickRandom(params);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Sets this generator as the global random number generator.
|
|
245
|
-
* @returns A result containing this generator or an error.
|
|
246
|
-
*/
|
|
247
|
-
public static setGlobalRng(rng?: PseudoRandomGenerator): PseudoRandomGenerator | undefined {
|
|
248
|
-
PseudoRandomGenerator._globalRng = rng;
|
|
249
|
-
return rng;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Gets the global random number generator.
|
|
254
|
-
* @returns The global random number generator or undefined if not set.
|
|
255
|
-
*/
|
|
256
|
-
public static getGlobalRng(): PseudoRandomGenerator | undefined {
|
|
257
|
-
return PseudoRandomGenerator._globalRng;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Ensures a random number generator is available, using the global generator if available
|
|
262
|
-
* or creating a new one if not.
|
|
263
|
-
* @param rng - The random number generator to use, or undefined to use the global one.
|
|
264
|
-
* @returns A random number generator.
|
|
265
|
-
*/
|
|
266
|
-
public static ensureRng(rng?: PseudoRandomGenerator): Result<PseudoRandomGenerator> {
|
|
267
|
-
rng = rng ?? PseudoRandomGenerator.getGlobalRng();
|
|
268
|
-
if (rng) {
|
|
269
|
-
return Success.with(rng);
|
|
270
|
-
}
|
|
271
|
-
return PseudoRandomGenerator.create();
|
|
272
|
-
}
|
|
273
|
-
}
|
package/src/generator/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Erik Fortune
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
// copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
// SOFTWARE.
|
|
20
|
-
|
|
21
|
-
export * from './randomSource';
|
|
22
|
-
export * from './generators';
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Erik Fortune
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
// copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
// SOFTWARE.
|
|
20
|
-
|
|
21
|
-
import { captureResult, Result } from '@fgv/ts-utils';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Represents a seed as both a string and a number.
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export interface ISeedPair {
|
|
28
|
-
seed: string;
|
|
29
|
-
state: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Result of an internal next() operation.
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export interface INextResult {
|
|
37
|
-
value: number;
|
|
38
|
-
nextState: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Function that steps a random number generator state and returns the next value.
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
export type RandomStepFunction = (state: number) => INextResult;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Constructor params for a {@link Generator.SeededRandomSource | SeededRandomSource}.
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
export interface ISeededRandomSourceConstructorParams {
|
|
52
|
-
state: number;
|
|
53
|
-
seed: string;
|
|
54
|
-
counter: number;
|
|
55
|
-
lineage: ReadonlyArray<string>;
|
|
56
|
-
step: RandomStepFunction;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Static create parameters for a {@link Generator.SeededRandomSource | SeededRandomSource}.
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
export interface ISeededRandomSourceCreateParams {
|
|
64
|
-
seed?: number | string;
|
|
65
|
-
step?: RandomStepFunction;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Seeded random number generator that can be cloned and used for deterministic generation.
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
72
|
-
export class SeededRandomSource {
|
|
73
|
-
private currentState: number;
|
|
74
|
-
public readonly seed: string;
|
|
75
|
-
public readonly lineage: ReadonlyArray<string>;
|
|
76
|
-
private _counter: number;
|
|
77
|
-
private _step: RandomStepFunction;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Gets the current counter value.
|
|
81
|
-
*/
|
|
82
|
-
public get counter(): number {
|
|
83
|
-
return this._counter;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Creates a new seeded random source.
|
|
88
|
-
* @param init - The constructor parameters.
|
|
89
|
-
*/
|
|
90
|
-
protected constructor(init: ISeededRandomSourceConstructorParams) {
|
|
91
|
-
this.currentState = init.state;
|
|
92
|
-
this.seed = init.seed;
|
|
93
|
-
this._counter = init.counter;
|
|
94
|
-
this._step = init.step;
|
|
95
|
-
this.lineage = init.lineage;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Creates a new seeded random source from an optional seed.
|
|
100
|
-
* @param seed - The optional seed value.
|
|
101
|
-
* @returns A new seeded random source.
|
|
102
|
-
*/
|
|
103
|
-
public static create(seed?: number | string): Result<SeededRandomSource>;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Creates a new seeded random source from {@link Generator.ISeededRandomSourceCreateParams | ISeededRandomSourceCreateParams}.
|
|
107
|
-
* @param init - The initialization parameters.
|
|
108
|
-
* @returns A new seeded random source.
|
|
109
|
-
*/
|
|
110
|
-
public static create(init: ISeededRandomSourceCreateParams): Result<SeededRandomSource>;
|
|
111
|
-
|
|
112
|
-
public static create(
|
|
113
|
-
seedOrInit?: number | string | ISeededRandomSourceCreateParams
|
|
114
|
-
): Result<SeededRandomSource> {
|
|
115
|
-
const init = typeof seedOrInit === 'object' ? seedOrInit : { seed: seedOrInit };
|
|
116
|
-
const step = init?.step ?? SeededRandomSource.mulberryStep;
|
|
117
|
-
const { seed, state } = SeededRandomSource.hashSeed(init?.seed ?? Date.now());
|
|
118
|
-
return captureResult(
|
|
119
|
-
() =>
|
|
120
|
-
new SeededRandomSource({
|
|
121
|
-
state,
|
|
122
|
-
seed,
|
|
123
|
-
counter: 0,
|
|
124
|
-
lineage: [],
|
|
125
|
-
step
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Generates the next random number.
|
|
132
|
-
* @returns A random number between 0 and 1.
|
|
133
|
-
*/
|
|
134
|
-
public next(): number {
|
|
135
|
-
this._counter += 1;
|
|
136
|
-
const { value, nextState } = this._step(this.currentState);
|
|
137
|
-
this.currentState = nextState;
|
|
138
|
-
return value;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Creates a clone of this random source.
|
|
143
|
-
* @returns A new seeded random source with the same state.
|
|
144
|
-
*/
|
|
145
|
-
public clone(): SeededRandomSource {
|
|
146
|
-
return new SeededRandomSource({
|
|
147
|
-
state: this.currentState,
|
|
148
|
-
seed: this.seed,
|
|
149
|
-
counter: this._counter,
|
|
150
|
-
lineage: this.lineage,
|
|
151
|
-
step: this._step
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Creates a child random source with a label.
|
|
157
|
-
* @param label - The label for the child.
|
|
158
|
-
* @returns A new seeded random source with a hashed state and label.
|
|
159
|
-
*/
|
|
160
|
-
public createChild(label: string): SeededRandomSource {
|
|
161
|
-
const { seed, state } = SeededRandomSource.hashStateAndLabel(this.currentState, label);
|
|
162
|
-
const lineage = [...this.lineage, `${this._counter}:${label}`];
|
|
163
|
-
return new SeededRandomSource({ state, seed, counter: 0, lineage, step: this._step });
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Steps a mulberry32 random number generator state and returns the next value.
|
|
168
|
-
* @param currentState - The current state of the generator.
|
|
169
|
-
* @returns The next random number and the next state.
|
|
170
|
-
*/
|
|
171
|
-
public static mulberryStep(currentState: number): INextResult {
|
|
172
|
-
const nextState = (currentState + 0x6d2b79f5) >>> 0;
|
|
173
|
-
|
|
174
|
-
let t = nextState;
|
|
175
|
-
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
176
|
-
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
177
|
-
|
|
178
|
-
const value = ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
179
|
-
return { value, nextState };
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Hashes a seed value.
|
|
184
|
-
* @param seed - The seed value.
|
|
185
|
-
* @returns A hashed seed value.
|
|
186
|
-
*/
|
|
187
|
-
public static hashSeed(seed: number | string): ISeedPair {
|
|
188
|
-
if (typeof seed === 'number') {
|
|
189
|
-
return { seed: seed.toString(), state: seed };
|
|
190
|
-
}
|
|
191
|
-
const parsedSeed = Number(seed);
|
|
192
|
-
if (!isNaN(parsedSeed) && isFinite(parsedSeed)) {
|
|
193
|
-
return { seed, state: parsedSeed };
|
|
194
|
-
}
|
|
195
|
-
return { seed, state: SeededRandomSource.hashString(seed) };
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Hashes a state and label.
|
|
200
|
-
* @param state - The state value.
|
|
201
|
-
* @param label - The label value.
|
|
202
|
-
* @returns A hashed state and label value.
|
|
203
|
-
*/
|
|
204
|
-
public static hashStateAndLabel(state: number, label: string): ISeedPair {
|
|
205
|
-
const seed = `${state >>> 0}:${label}`;
|
|
206
|
-
return { seed, state: SeededRandomSource.hashString(seed) };
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Hashes a string value.
|
|
211
|
-
* @param value - The string value.
|
|
212
|
-
* @returns A hashed string value.
|
|
213
|
-
*/
|
|
214
|
-
private static hashString(value: string): number {
|
|
215
|
-
let hash = 0x811c9dc5;
|
|
216
|
-
|
|
217
|
-
for (let index = 0; index < value.length; index++) {
|
|
218
|
-
hash ^= value.charCodeAt(index);
|
|
219
|
-
hash = Math.imul(hash, 0x01000193);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return hash >>> 0;
|
|
223
|
-
}
|
|
224
|
-
}
|