Constructs a counter table with an initial token.
Checks if the counter table contains a given token.
Returns the counter value for a token.
Returns the counter value for a token. If the token doesn't exist, 0 is returned.
Pokes a token in the counter table, incrementing its counter value. If the token doesn't exist, it's created and assigned a counter of 1.
Sets the counter value for a given token.
Checks if the counter table is empty.
Returns a list of tokens in the counter table.
Returns the length of the counter table.
Returns a random token with equal distribution. If the counter table is emtpy, null is returned instead.
Rebuilds the associative arrays used by the counter table.
Returns a random token, distributed based on the counter values. Specifically, a token with a higher counter is more likely to be chosen than a token with a counter lower than it. If the counter table is empty, null is returned instead.
Returns the sum of all counters on all tokens. The value is cached once it's been computed.
Represents a set of counters for trailing (following) tokens in a markov state.