Skip to content

Commit

Permalink
fix: we should use [1, 100] for percentage instead of [0, 100] (#2980)
Browse files Browse the repository at this point in the history
Previously, we got n+1/101 as the percentage.
  • Loading branch information
spacewander authored Dec 8, 2020
1 parent 9324194 commit 4719977
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apisix/plugins/fault-injection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ local function sample_hit(percentage)
return true
end

return random(0, 100) <= percentage
return random(1, 100) <= percentage
end


Expand Down

0 comments on commit 4719977

Please sign in to comment.