From ea2b89c7ae69424055652db30f49182d4a987bf7 Mon Sep 17 00:00:00 2001 From: Ivan Kurnosov Date: Sat, 27 Jan 2018 06:36:44 +1300 Subject: [PATCH] Added `+1` to the `end` in `random` filter so that it was inclusive (#27215) --- lib/ansible/plugins/filter/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/filter/core.py b/lib/ansible/plugins/filter/core.py index f4487f7d245..b471c16a7c9 100644 --- a/lib/ansible/plugins/filter/core.py +++ b/lib/ansible/plugins/filter/core.py @@ -235,7 +235,7 @@ def rand(environment, end, start=None, step=None, seed=None): start = 0 if not step: step = 1 - return r.randrange(start, end, step) + return r.randrange(start, end + 1, step) elif hasattr(end, '__iter__'): if start or step: raise AnsibleFilterError('start and step can only be used with integer values')