{"name":"BIS_fnc_nearestNum","title":"BIS fnc nearestNum","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_nearestNum","revid":328545,"updated":"2022-07-13T17:02:17Z","groups":["Arrays","Math"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Returns the provided set closest number to the target number.","syntaxes":[{"syntax":"[values, value] call BIS_fnc_nearestNum","params":[{"name":"values","type":"Array of Numbers","description":"values to choose from","type_expr":"Array<Number>"},{"name":"value","type":"Number","description":"the reference value","type_expr":"Number"}],"returns":{"type":"Number","type_expr":"Number","description":"the closest value"}}],"examples":[{"code":["private _closestValueTo4 = [[1,5,10], 4] call BIS_fnc_nearestNum; // returns 5"]}],"see_also":["BIS_fnc_randomNum","random"]}