Package org.mockserver.model
Class ChaosProbability
java.lang.Object
org.mockserver.model.ChaosProbability
Shared deterministic probability-draw logic for chaos injection, used by both
HttpChaosProfile (HTTP fault injection) and LlmChaosProfile
(LLM fault injection).
Determinism contract:
probability == nullorprobability >= 1.0→ always injectprobability <= 0.0→ never inject- Otherwise a single draw decides; when
seed != nullthe draw is reproducible (same seed always yields the same result).
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanshouldInject(Double probability, Long seed) Returnstruewhen a chaos fault should be injected, based on the given probability and optional seed for reproducibility.
-
Method Details
-
shouldInject
Returnstruewhen a chaos fault should be injected, based on the given probability and optional seed for reproducibility.- Parameters:
probability- a value in [0.0, 1.0], ornull(treated as 1.0)seed- optional seed for reproducible draws;nulluses ThreadLocalRandom- Returns:
trueif the fault should fire
-