Random number generator with deterministic modes for testing.
Provides random number generation that can operate in different modes:
// Production: real randomnessconst random = new RandomService(RandomMode.RANDOM);const value = random.Random0ToValue(100); // 0-100// Testing: constant valueconst constRandom = new RandomService(RandomMode.CONST);const value = constRandom.Random0ToValue(100); // Always 50// Testing: stepped sequenceconst stepRandom = new RandomService(RandomMode.STEP);const v1 = stepRandom.Random0ToValue(100); // 0.01const v2 = stepRandom.Random0ToValue(100); // 0.02 Copy
// Production: real randomnessconst random = new RandomService(RandomMode.RANDOM);const value = random.Random0ToValue(100); // 0-100// Testing: constant valueconst constRandom = new RandomService(RandomMode.CONST);const value = constRandom.Random0ToValue(100); // Always 50// Testing: stepped sequenceconst stepRandom = new RandomService(RandomMode.STEP);const v1 = stepRandom.Random0ToValue(100); // 0.01const v2 = stepRandom.Random0ToValue(100); // 0.02
Readonly
Generates a random number between 0 and the specified value.
Maximum value (exclusive upper bound)
Random number in range [0, value)
Random number generator with deterministic modes for testing.
Provides random number generation that can operate in different modes:
Example