arrayShuffle
Definition
-- @/lua/common/utils.lua:773
--Fisher-Yates shuffle for pure arrays
function arrayShuffle(array)
for i = #array, 2, -1 do
local j = random(i)
array[i], array[j] = array[j], array[i]
end
return array
end
Callers
@/lua/ge/extensions/core/multiSpawn.lua
end
array = arrayShuffle(array)
if options.shuffle then -- randomize group order
group = arrayShuffle(deepcopy(group))
end
@/lua/ge/extensions/career/modules/delivery/generator.lua
local function randomFromList(list)
arrayShuffle(list)
return list[1] or nil
@/flowgraphEditor/Tower/customNodes/towerNode.lua
end
list = arrayShuffle(list)
--dump(list)
if elem.pick == "shuffle" then
typeFiles = arrayShuffle(typeFiles)
elseif elem.pick == "random" then
@/lua/ge/extensions/editor/multiSpawnManager.lua
if next(currGroup) and currGroup.data then
currGroup.data = arrayShuffle(currGroup.data)
selectVehIndex(1)
@/gameplay/missionTypes/scatterPickup/customNodes/scatterPrefabSetupNode.lua
end
list = arrayShuffle(list)
--dump(list)
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/trafficMoveGroup.lua
if self.pinIn.shuffle.value then
self.vehIds = arrayShuffle(deepcopy(self.vehIds))
end
@/lua/ge/extensions/editor/missionEditor/playbookUtils.lua
if #stars > 1 then
arrayShuffle(stars)
instruction.stars[stars[1]] = true
local keys = deepcopy(self.missionInstance.careerSetup._activeStarCache.bonusStarKeysSorted)
arrayShuffle(keys)
for _, key in ipairs(keys) do
@/lua/ge/extensions/gameplay/city.lua
-- randomize parkingspot names
names = arrayShuffle(names)
local nameA, nameB = names[1], names[2]
@/lua/ge/extensions/career/modules/vehicleClassGrouping.lua
-- the code below shuffles the group, but prevents same consecutive models in the group data array
group.data = arrayShuffle(group.data)
@/lua/vehicle/beamstate.lua
-- local wholeNumberOfBrokenBreakGroups = floor(numberOfBrokenBreakGroups)
-- local shuffledBreakGroups = arrayShuffle(partBreakGroups)
-- for i = 1, wholeNumberOfBrokenBreakGroups do
@/lua/ge/extensions/freeroam/specialTriggers.lua
if data.randomOrder then
data.idxList = arrayShuffle(data.idxList) -- random index order to use for target scenetree group
end
@/lua/common/utils.lua
end
arrayShuffle(ctx)
ctx.i, ctx.t = 1, t