Formula

CommonFun.GetRandom

formula.lua
1function CommonFun.GetRandom(array, index)
2  local MAX_RANDOM_INDEX = 100
3  local group = math.ceil(index / 5)
4  local key = index - math.floor(index / 5) * 5
5  key = key ~= 0 and key or 5
6  if array[group] == nil or index > MAX_RANDOM_INDEX then
7    return 0, index
8  end
9  local groupValue = array[group]
10  local value = math.floor(groupValue / math.pow(100, 5 - key)) % 100
11  local newIndex = index == MAX_RANDOM_INDEX and 1 or index + 1
12  return value, newIndex
13end
Formula Graph

Connected Archive Data

See which cards, equipment, headwears, buffs, and other archived records connect to this formula.

Loading graph filters

CommonFun.GetRandom

commonfun-getrandom

Nodes

0

Edges

0

Related Nodes

Select at least one node type.