WeightedRandom.Utils.Types (weighted_random v1.0.0-alpha.1)

Copy Markdown View Source

Summary

Types

Anything compatible with Curves.define_bezier/3.

See function docs for details.

The values to be randomly picked from.

A list of floats, representing percentages, that should add up to 1.0

The weight, as given by the end user, which will influence the randomization.

Types

curve_spec()

@type curve_spec() :: atom() | [{number(), number()}]

Anything compatible with Curves.define_bezier/3.

opts()

@type opts() :: keyword()

See function docs for details.

outcomes()

@type outcomes() :: [...] | Range.t()

The values to be randomly picked from.

probabilities()

@type probabilities() :: [float()]

A list of floats, representing percentages, that should add up to 1.0

weight_spec()

@type weight_spec() :: %{
  :target => any(),
  required(:amount | :weight) => number(),
  optional(:left_dist) => integer(),
  optional(:right_dist) => integer(),
  optional(:radius) => integer(),
  optional(:curve) => curve_spec()
}

The weight, as given by the end user, which will influence the randomization.