Random number generation

From Caves of Qud Wiki
Jump to navigation Jump to search
This article may need cleanup to meet quality standards.
Please help improve this page by editing it.

Reason: "Needs more info on main channel RNG, world generation, and Irritable Genome. Probably needs some rephrasing for clarity as well."

This article may need cleanup to meet quality standards.
Please help improve this page by editing it.

Reason: "Needs more info on main channel RNG, world generation, and Irritable Genome. Probably needs some rephrasing for clarity as well."

Random number generation (RNG) is used in most mechanics in Caves of Qud. There are two kinds of RNG in Qud - the main channel, which is used for most random effects, and specially seeded channels, which are used for particular effects that cannot be normally rerolled.

Main channel

The main channel is used by almost anything that needs random values, including cooking with neutron flux[1]. Anything dependent on the main channel can be rerolled with Precognition. Notably, the random result for mutants of Eaters' nectar injectors uses the main RNG channel rather than a seeded channel, unlike drops of nectar.[2]

Seeded RNG

A few rolls use named RNG channels with a stored seed. A roll on one of these channels is uniquely determined by the seed, and generates a new seed which is then saved on the associated game object (usually the player) for the next roll.[3] This means that they cannot be trivially rerolled with Precognition effects, as returning to the beginning of the vision will restore the original seed. However, some seeded RNG channels can be rerolled by specific in-game effects outside of their main usages. Body swapping with a clone may also reset seeded effects. The seeded effects are:

  • Obtaining Mutations - this uses the "RandomMutationBuy" channel and applies mainly to the set of options when buying a new mutation.[4] The mutation RNG channel can be rerolled by applying an Eaters' nectar injector or cooking with a drop of nectar. Additionally, the mutating effect (from the mutating gaze of a gamma moth) repeatedly rerolls this channel when it gives the message "You feel increasingly unstable.".[5][6]
  • Drinking brain brine - this uses the "brainbrine" channel. While the effect type is determined by the seeded RNG, the specific result can be determined by other RNG channels. For instance, if drinking brain brine gives secrets or skills, it will continue to give the same number of secrets or skills even when rerolled with Precognition, but the specific secrets or skills will be picked using the general RNG channel. However, if it gives a mutation, it uses its own seeded RNG channel rather than the mutation RNG channel.[7] Like mutations, this RNG channel can be rerolled by applying an Eaters' nectar injector or cooking with a drop of nectar. Additionally, the mutating effect (from the mutating gaze of a gamma moth) repeatedly rerolls this channel when it gives the message "You feel increasingly unstable.".[5][6]
  • Cooking with drops of nectar - this uses the "CookingDomainAttributes_UnitPermanentAllStats_25Percent" channel. Note that this is a separate channel from the mutation and brain brine seeded RNGs, even though the cooking effect rerolls both of these channels.[8][6] It cannot be rerolled through any means.
  • Generation of Sultan murals in the Tomb of the Eaters - this uses the "SultanMural" channel.[9] This cannot be rerolled through any means and has no mechanical impact on gameplay.

References

This information is reliable as of patch 2.0.203.28.
  1. XRL.World.Effects.CookingDomainDensity_UnitPermanentAV
  2. XRL.World.Parts.Nectar_Tonic_Applicator
  3. XRL.World.GameObject, method WithSeededRandom
  4. XRL.UI.StatusScreen, method BuyRandomMutation
  5. 5.0 5.1 XRL.World.Effects.Mutating
  6. 6.0 6.1 6.2 XRL.World.GameObject, method PermuteRandomMutationBuys
  7. XRL.World.Effects.BrainBrineCurse
  8. XRL.World.Effects.CookingDomainAttributes_UnitPermanentAllStats_25Percent
  9. XRL.World.Parts.SultanMuralController