/** * Shared utility functions for simulation components. * * Centralizes logic that would otherwise be duplicated across Server, * Database, Cache, Queue, and LoadBalancer components. */ import type { SimEvent, WorkUnit } from '../../types/events.ts'; import type { SimContext } from '../../types/components.ts'; import type { Distribution, LoadDependentLatency } from '../../types/configs.ts'; /** * Create a departure event directed back to the work unit's originating client. */ export declare function createDepartureToOrigin(workUnit: WorkUnit, context: SimContext, failed: boolean): SimEvent; /** * Sample from a probability distribution using the context's seeded PRNG. * * Implements inverse transform sampling for exponential, Box-Muller for * log-normal, and linear mapping for uniform. */ export declare function sampleDistribution(dist: Distribution, context: SimContext): number; /** * Apply load-dependent latency scaling to a base service time. * * Utilization (u) is typically activeConnections / poolSize, in [0, 1]. * - Linear: base × (1 + factor × u) * - Polynomial: base × (1 + factor × u^exponent) * - Exponential: base × e^(factor × u) */ export declare function applyLoadDependentLatency(base: number, utilization: number, config: LoadDependentLatency): number; //# sourceMappingURL=shared.d.ts.map