Update fn_buildWeightedArray.sqf

private fix
This commit is contained in:
F507DMT
2021-05-05 12:17:26 +06:00
committed by GitHub
parent e50900793f
commit 8d89c62239

View File

@@ -18,9 +18,9 @@ scriptName "Functions\arrays\fn_selectRandomWeighted.sqf";
[*] Algorithm is inefficient?
*/
private["_weighted"];
private["_weights","_weighted","_weight"];
_array = _this select 0;
// _array = _this select 0;
_weights = _this select 1;
/*
@@ -34,7 +34,6 @@ if ((count _array) > (count _weights)) exitWith {debugLog "Log: [selectRandomWei
_weighted = [];
for "_i" from 0 to ((count _weights) - 1) do
{
private ["_weight"];
_weight = _weights select _i;
//Ensure the weight is a Number.
@@ -53,4 +52,4 @@ for "_i" from 0 to ((count _weights) - 1) do
_weighted set [(count _weighted), _i];
};
};
_weighted
_weighted