Probability

  • A struct that represents the chances of different Rolls happening.

    Since

    0.16.0

    Author

    Samasaur
    See more

    Declaration

    Swift

    public struct Chances
    extension Chances: Equatable
    extension Chances: Hashable
    extension Chances: Describable
  • A struct that represents the chance or probability of something happening.

    Chances are stored as fractions, and the constructors that take decimal values use some algorithm off of StackOverflow to convert them to fractions.

    Since

    0.16.0

    Author

    Samasaur
    See more

    Declaration

    Swift

    public struct Chance
    extension Chance: Equatable
    extension Chance: Hashable
    extension Chance: ExpressibleByFloatLiteral
    extension Chance: Describable
  • An object that caches the results of intensive computations.

    In DiceKit, the only cached values are probability computations, which can be very intensive.

    The results of rolling are NOT cached.

    Implemented By

    See ENABLE_CACHING for configuring caching of all Caching types.

    Since

    0.22.0

    Author

    Samasaur
    See more

    Declaration

    Swift

    public protocol Caching
  • Whether or not DiceKit types should cache the results of probability computations across objects.

    The results of rolling are NOT cached.

    Every type that supports caching has its own enableCaching property. Setting this property overwrites each type’s configuration. This property returns true when every supported type has caching enabled, and false when any supported type has caching disabled.

    Types that currently support caching:

    Since

    0.22.0

    Declaration

    Swift

    public var ENABLE_CACHING: Bool { get set }