diff --git a/toxics/toxic.go b/toxics/toxic.go index 9f90b7bd..df4d6716 100644 --- a/toxics/toxic.go +++ b/toxics/toxic.go @@ -81,8 +81,8 @@ func NewToxicStub(input <-chan *stream.StreamChunk, output chan<- *stream.Stream func (s *ToxicStub) Run(toxic *ToxicWrapper) { s.running = make(chan struct{}) defer close(s.running) - // #nosec G404 -- was ignored before too - if rand.Float32() < toxic.Toxicity { + randomToxicity := rand.Float32() // #nosec G404 -- was ignored before too + if randomToxicity < toxic.Toxicity { toxic.Pipe(s) } else { new(NoopToxic).Pipe(s)