From 91d246e64e93f5898babf069f6482a39652052b5 Mon Sep 17 00:00:00 2001 From: icomrade Date: Tue, 27 May 2014 15:36:56 -0400 Subject: [PATCH] More even distribution of return --- SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf b/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf index f9dafd63b..8184cacc2 100644 --- a/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf +++ b/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf @@ -8,16 +8,16 @@ Parameters: array This returns a randomly selected element from the passed array. Example: [1,2,3] call BIS_fnc_selectRandom -Returns: 1, 2, or 3 +Returns: 1, 2, || 3 ************************************************************/ private "_ret"; if(count _this > 0) then { - _ret = (count _this) - 1; //number of elements in the array + _ret = count _this; //number of elements in the array //_ret = [0, _ret] call BIS_fnc_randomInt; //choose random index - _ret = random _ret; + _ret = floor(random _ret); _ret = _this select _ret; //get the element, return it }; _ret