Rerouted (regenerated, verified). Same repository and tag, but GitHub now builds the zip with different bytes, so it no longer matches the SHA-1 package.elm-lang.org recorded. The Lamdera package server serves a copy recovered from https://github.com/kudzu-forest/elm-random-tree.
What we checked: Rebuilt with git archive from commit ce921ee5bf92 of https://github.com/kudzu-forest/elm-random-tree (zip prefix kudzu-forest-elm-random-tree-ce921ee/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 270e255f44195adf4d02408b8a27294f1c8206ad.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/kudzu-forest/elm-random-tree/zipball/3.0.0/
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.
Tree in this module
take, delete, and filter) all return Maybe (Tree a) just in case all the elements are deleted.fromList takes one heading element and tailing list.(similar with Random.uniform or Random.weighted.)1. This may be an error prone, but otherwise all things must be wrapped in Maybe.member and delete is O(N).delete or filter is called, so when I say "The time complexity is O(log(N))", N denotes the maximal size in the history of the tree so far.Type alias that represents each weighted contents in Tree. The probability of being chosen is proportional to its weight.
The weight is represented with WideFloat.WideFloat type in kudzu-forest/elm-wide-float package.
Type that represent floating point number with wider range than Float in core package. This is introduced for preventing overflow of exponentially changing value.
Please hit elm install kudzu-forest/elm-wide-float in your terminal.
Returns weighted datum whose weight is multiplied with the given Float.
Maps content in Element.
Returns a Tree that has only one element. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)
Returns a Tree that has all element in given list.Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)
Creates Tree from list of tuples of a Float value corresponding to its weight as the first component, and a datum as the second component. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)
Inserts a Weighted data to an already-existing Tree. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)
Inserts an element into the tree. The first parameter denotes the relative weight(1 means the whole weight of the original tree). The time complexity is O(log(N)).
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).
Removes any number of elements which is the same as the first parameter from the second parameter. The returned value is wrapped in Maybe. The time complexity is O(N).
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.
Random generator that generates one of the elements conteined in Tree given as parameter. The probability for each elements to be chosen is proportional to its weight. The time complexity is O(log(N)).
Random generator that generates one of the elements conteined in Tree, paired with the rest part of the tree.
If the Tree has only one element, then Nothing is returned as the second component.
The time complexity is O(log(N)).
Random generator that replaces one weighted data from the tree and generates a pair consisting of the removed data and resultant tree. The time complexity is O(log(N))
Returns the sum of weight of all the elements in the tree. The time complexity is O(1)
Type that represents binary tree with weighted elements subjected to random picking up.