jxxcarlson/elm-tree-builder/3.1.0

NOTE: the latest version is 7.0.0

Tree.Random

Utilities for generating and collecting statistics on random trees.

generate : Int -> Int -> Result Error (Tree String)

Generate a random rose tree with the given number nodes and with given seed.

generateOutline : Int -> Int -> String

Generate a random outline.

depths : Int -> Int -> Int -> List ( Int, Int )
depths k n seed:  generate n random trees of k nodes using the given seed
and collect statistics on their depths


> depths 10 10 0
[(2,1),(3,2),(4,3),(5,2),(8,2)] -- one tree of depth two, two trees of depth three, etc.


> depths 10 10 1
[(2,1),(3,1),(4,3),(5,2),(7,1),(8,2)]


> depths 10 10 2
[(2,1),(3,2),(4,3),(5,2),(7,1),(8,1)]