Donnovan Posted January 1, 2016 Report Share Posted January 1, 2016 SYNTAX: result = [array,factor] call LOL_fnc_selectRandomFactor; array is an array with elements. Those elements can be of type array. factor is how much the elements with lower index will be priorized (look the image on the link bellow). result is an element of "array". EXAMPLE 1: //EXAMPLE //_randomVeh have a 55% chance to be "car_hatchback" //_randomVeh have a 20% chance to be "hilux1_civil_3_open" //_randomVeh have a 15% chance to be "UAZ_CDF" //_randomVeh have a 10% chance to be "HMMWV" _vehicles = ["car_hatchback","hilux1_civil_3_open","UAZ_CDF","HMMWV"]; _randomVeh = [_vehicles,2.25] call LOL_fnc_selectRandomFactor; EXAMPLE 2 (making it like BIS_fnc_selectRandom): //EXAMPLE //_randomVeh have a 25% chance to be "car_hatchback" //_randomVeh have a 25% chance to be "hilux1_civil_3_open" //_randomVeh have a 25% chance to be "UAZ_CDF" //_randomVeh have a 25% chance to be "HMMWV" _vehicles = ["car_hatchback","hilux1_civil_3_open","UAZ_CDF","HMMWV"]; _randomVeh = [_vehicles,1] call LOL_fnc_selectRandomFactor; THE FUNCTION: LOL_fnc_selectRandomFactor = { _array = _this select 0; _factor = _this select 1; _array select (floor ((random ((count _array)^(1/_factor)))^(_factor))) }; SHART ANALISYS OF THE FUNCTION: Link to comment Share on other sites More sharing options...
Donnovan Posted January 1, 2016 Author Report Share Posted January 1, 2016 Can i make the image visible on post? Thankyou. Link to comment Share on other sites More sharing options...
Richie Posted January 1, 2016 Report Share Posted January 1, 2016 1 hour ago, Donnovan said: Can i make the image visible on post? Thankyou. Done :) Donnovan 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now