AliasMethod.Table (Alias Method v0.1.0)

struct represents probability table and alias table generated by weights

Link to this section Summary

Link to this section Types

Specs

t() :: %AliasMethod.Table{
  alias_table: %{required(integer()) => number()},
  length: integer(),
  probability_table: %{required(integer()) => number()}
}

Link to this section Functions

Specs

choice(t()) :: integer()
Link to this function

generate(weights)

Specs

generate([float()]) :: t()