jxxcarlson / elm-tree-builder / Tree.Random

Utilities for generating and collecting statistics on random trees.

generate : Basics.Int -> Basics.Int -> Result Tree.Build.Error (Tree String)

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

generateOutline : Basics.Int -> Basics.Int -> String

Generate a random outline.

depths : Basics.Int -> Basics.Int -> Basics.Int -> List ( Basics.Int, Basics.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)]