[{"name":"RandomTree","comment":" This module provides data structure that allows random picking up from a collection of data in _O(log(N))_ time. You can set weight of each element with `WideFloat` from `kudzu-forest/elm-wide-float` package.\n\n\n# Types\n\n@docs RandomTree, Weighted, WideFloat\n\n\n# Operation around weighted datum\n\n@docs adjustWeight, adjustContent\n\n\n# Creation\n\n@docs singleton, fromList, fromPairs\n\n\n# Insertion\n\n@docs insert, insertWithRelativeWeight, insertListWithRelativeWeight\n\n\n# Modification\n\n@docs delete, map, filter\n\n\n# Random Pick Up\n\n@docs get, take, replace\n\n\n# Query\n\n@docs count, totalWeight\n\n","unions":[{"name":"RandomTree","comment":" Type that represents binary tree with weighted elements for random picking up.\n","args":["a"],"cases":[]}],"aliases":[{"name":"Weighted","comment":" Type alias that represents each weighted contents in `RandomTree`.\n","args":["a"],"type":"{ weight : RandomTree.WideFloat, content : a }"},{"name":"WideFloat","comment":" Type that represent floating point number with wider range than `Float` in core package. This is introduced for preventing overflow of exponentially changing value.\nIf you need to directly manipulate values of `WideFloat`, please hit `elm install kudzu-forest/elm-wide-float` in your terminal.\n","args":[],"type":"WideFloat.WideFloat"}],"values":[{"name":"adjustContent","comment":" Maps content in `Element`.\n","type":"(a -> b) -> RandomTree.Weighted a -> RandomTree.Weighted b"},{"name":"adjustWeight","comment":" Returns weighted datum whose weight is multiplied with the given `Float`.\n","type":"Basics.Float -> RandomTree.Weighted a -> RandomTree.Weighted a"},{"name":"count","comment":" Returns how many elements the tree has.\n","type":"RandomTree.RandomTree a -> Basics.Int"},{"name":"delete","comment":" Removes any number of elements which is the same as the first parameter from the second parameter. The returned value is wrapped in `Maybe`.\n","type":"a -> RandomTree.RandomTree a -> Maybe.Maybe (RandomTree.RandomTree a)"},{"name":"filter","comment":" Removes any number of elements which passes the test function given as the first parameter from the second parameter. The returned value is wrapped in `Maybe`.\n","type":"(RandomTree.WideFloat -> a -> Basics.Bool) -> RandomTree.RandomTree a -> Maybe.Maybe (RandomTree.RandomTree a)"},{"name":"fromList","comment":" Returns a `RandomTree` that has all element in given list.\n","type":"RandomTree.Weighted a -> List.List (RandomTree.Weighted a) -> RandomTree.RandomTree a"},{"name":"fromPairs","comment":" Creates `RandomTree` from list of tuples of a `Float` value corresponding to its weight as the first component, and a datum as the second component.\nthe weighter it is, the higher probability it is chosen in.\n","type":"( Basics.Float, a ) -> List.List ( Basics.Float, a ) -> RandomTree.RandomTree a"},{"name":"get","comment":" Random generator that generates one of the elements conteined in `RandomTree` given as parameter.\nThe time complexity is _O(log(N))_ where _N_ denotes the size of the tree.\n","type":"RandomTree.RandomTree a -> Random.Generator a"},{"name":"insert","comment":" Inserts a Weighted data to an already-existing `RandomTree`.\n","type":"RandomTree.Weighted a -> RandomTree.RandomTree a -> RandomTree.RandomTree a"},{"name":"insertListWithRelativeWeight","comment":" Inserts all elements of given list into the tree of second parameter. The first components of the tuple denotes the relative weight(`1` means the whole weight of the original tree).\n","type":"List.List ( Basics.Float, a ) -> RandomTree.RandomTree a -> RandomTree.RandomTree a"},{"name":"insertWithRelativeWeight","comment":" Inserts an element into the tree. The first parameter denotes the relative weight(`1` means the whole weight of the original tree).\n","type":"Basics.Float -> a -> RandomTree.RandomTree a -> RandomTree.RandomTree a"},{"name":"map","comment":" Maps all the content of the tree, with the weights unchanged.\n","type":"(a -> b) -> RandomTree.RandomTree a -> RandomTree.RandomTree b"},{"name":"replace","comment":" Random generator that replaces one weighted data from the tree and generates a pair consisting of the removed data and resultant tree.\n","type":"RandomTree.Weighted a -> RandomTree.RandomTree a -> Random.Generator ( RandomTree.Weighted a, RandomTree.RandomTree a )"},{"name":"singleton","comment":" Returns a `RandomTree` that has only one element.\n","type":"RandomTree.Weighted a -> RandomTree.RandomTree a"},{"name":"take","comment":" Random generator that generates one of the elements conteined in `RandomTree`, paired with the rest part of the tree.\nIf the `RandomTree` has only one element, then `Nothing` is returned as the second component.\nThe time complexity is _O(log(N))_ where _N_ denotes the size of the tree.\n","type":"RandomTree.RandomTree a -> Random.Generator ( RandomTree.Weighted a, Maybe.Maybe (RandomTree.RandomTree a) )"},{"name":"totalWeight","comment":" Returns the sum of weight of all the elements in the tree.\n","type":"RandomTree.RandomTree a -> RandomTree.WideFloat"}],"binops":[]}]