## By Devove, FineNerds, & VoiD_Glitch

#### WARFRAME - RARITY WEIGHTS AND “RANDOM” NUMBER GENERATION

### INTRODUCTION

Random Number Generation is the generation of a sequence of numbers or symbols that cannot be reasonably predicted better than by a random chance, usually through a random-number generator (RNG). Random Number Generation is an essential factor to in-game items as the drop chance of an item can determine its market value and influence a player's means of obtaining it (as in, farming for or purchasing it). There is no way to generate random numbers deterministically, but algorithms do exist that give the appearance of a random sequence. The algorithm *Warframe* makes use of is *Donald Knuth*'s version of a Linear Congruential Generator (LCG), scaling off of Rarity Weights that influence the drop chances of items in `DropTables`

and `MissionDecks`

files. Note that the formula `Xn = (aXn-1 + c) mod m`

only applies to missions that involve getting rewards over time, such as Defense and Survival. This concept is explained by Pwnatron in this thread, starting with “The order of these items is important in a way.” In the cases of missions like Capture and Exterminate, they simply use the process that will be explained later in this article.

### RARITY WEIGHTS

*Warframe* makes use of four (4) Rarity Weights in its Random Number Generation algorithm. These weights are uniform across `DropTables`

and `MissionDecks`

, with the exception of `/Lotus/Types/Game/MissionDecks/SortieRewards`

, which uses `FixedWeights`

(Weights that Digital Extremes manually assigns).

RARITY | WEIGHT | PERCENTAGE |
---|---|---|

COMMON | 0.755 | 75.50% |

UNCOMMON | 0.22 | 22.00% |

RARE | 0.02 | 2.00% |

LEGENDARY | 0.005 | 0.50% |

`0.755 + 0.22 + 0.02 + 0.05 = 1`

### FORMULAE

```
COMMON DROP CHANCE (PER ITEM) = BASE COMMON DROP CHANCE / NUMBER OF [COMMON] ITEMS
```

```
UNCOMMON DROP CHANCE (PER ITEM) = BASE UNCOMMON DROP CHANCE / NUMBER OF [UNCOMMON] ITEMS
```

```
RARE DROP CHANCE (PER ITEM) = BASE RARE DROP CHANCE / NUMBER OF [RARE] ITEMS
```

```
LEGENDARY DROP CHANCE (PER ITEM) = BASE LEGENDARY DROP CHANCE / NUMBER OF [LEGENDARY] ITEMS
```

### PROCEDURE (EXAMPLE)

DATA SELECTION: 8 COMMON, 6 UNCOMMON, 4 RARE, 2 LEGENDARY

` COMMON: 0.755 / 8 = 0.094375 = 9.4375 = 9.44%`

` UNCOMMON: 0.22 / 6 = 0.0366666666666667 = 3.66666666667 = 3.67%`

` RARE: 0.02 / 4 = 0.005 = 0.5 = 0.50%`

` LEGENDARY: 0.005 / 2 = 0.0025 = 0.25 = 0.25%`

` COMMON: 9.4375 * 8 = 75.5`

` UNCOMMON: 3.66666666667 * 6 = 22`

` RARE: 0.5 * 4 = 2`

`LEGENDARY: 0.25 * 2 = 0.5`

### NORMALIZATION

Normalization occurs when one or more of the Rarity Weights are not present in a `DropTable`

or `MissionDeck`

. Normalization has many meanings, but in this case it refers to the division of constants that are added up so values fall between zero (0) and one (1) within different data sets.

### NORMALIZATION PROCEDURE (EXAMPLE)

DATA SELECTION: 1 COMMON, 1 UNCOMMON, 1 RARE, 0 LEGENDARY

` COMMON: 0.755 / (0.755 + 0.22 + 0.02) = 0.7587939698492462 = 75.87939698492462 = 75.88%`

`UNCOMMON: 0.22 / (0.755 + 0.22 + 0.02) = 0.221105527638191 = 22.1105527638191 = 22.11%`

` RARE: 0.02 / (0.755 + 0.22 + 0.02) = 0.0201005025125628 = 2.010050251256281 = 2.01%`

`75.87939698492462 + 22.1105527638191 + 2.010050251256281 = 100`

### ATTENUATION

Attenuation is a variable exclusive to `DropTables`

. The Boolean `OverrideLevelAdjustedBiasAtten`

determines if Attenuation is present in a `DropTable`

or not. Attenuation is defined as “the reduction of the force, effect, or value of something.” This means that as the Attenuation value increases, the drop chance of an item should decrease. However, because of how minor its set value (`0.5`

) is (from one of the Boolean's secondary variables, `RareAttenMax`

), and that it impacts `DropTables`

globally instead of individual items, it is impossible to accurately determine if it has a noticeable impact on items at all.

### BIAS

Bias is a variable exclusive to `DropTables`

. Bias can be applied to items within `DropTables`

but is not global across any. Bias is defined as “a feature of a statistical technique or of its results whereby the expected value of the results differs from the true underlying quantitative parameter being estimated.” This means that the sole purpose of Bias is to unequally weigh items within `DropTables`

(through a positive (+) or negative (-) value change), even if said items have identical Rarity Weights. In *Warframe*, Bias is a variable that negatively impacts the drop chance of an item. The more Bias an item has, the lower its drop chance is. Additionally, because Bias scales from the Rarity Weight that the item it is impacting is assigned to, items with Rarity Weights that hold more weight than others will still tend to drop more often, depending on the amount of Bias that is present. I had individuals help me confirm this theory.

### REWARD SEEDS

`rewardSeed`

is a variable exclusive to `MissionDecks`

. It is a 64-bit integer that determines the `missionReward`

players receive at the end of a mission. It is granted to you at the start of the mission, and remains with you until its completion. `rewardSeeds`

are given to the host, and members of the host’s group receive the `sessionId`

in order to participate in the same session. You will only receive a `rewardSeed`

when your client needs to distribute it to players in a group (as the host). This means that you will receive a `rewardSeed`

if you begin a Public, Friends Only, or Invite Only session, but if you begin a Solo session, you will not be given a `rewardSeed`

. Despite the `SRand`

variable (the seeding for the random number generator (a pseudo-random integer between 0 and RAND_MAX)) being different for each player, each player will always receive the same `missionReward`

as the host, because of their identical `sessionIds`

.

### ADDITIONAL RESOURCES

Use this Seed Randomization Generator to generate text simulations of an integer seeded by an SRand variable based on time. Use this Weighted Random Number Generator to generate text simulations of Weighted Random Number Generation, based on two hundred (200) instances. Initial values are set to imitate the *Warframe* Random Number Generation algorithm. *VoiDLabs* Discord guild can be found here.