Generate a random term. Options override the defaults below and may
be given either as an option list or as a dict. Weigths (w_*) are
handled as relative weights in two groups:
w_leaf, w_share, w_copy, w_cycle and w_compound
control the (compound) shape of the resulting term.
w_atom, w_int, w_float, w_rational and w_string
control what leaf node is generated after the group above
decided to create a leaf.
Defaults:
#{
depth: 5, % maximum recursion depth
depth_decay: 0.5, % w_compound is scaled by this per level
max_arity: 3, % maximum compound arity
functors: [f,g,h,p,q],
atoms: [a,b,c],
max_int: 100, % random integer leaves in 0..max_int
p_zero_arity: 0.1, % fraction on zero-arity compounds.
w_leaf: 10, % choice weights
w_share: 30,
w_copy: 15,
w_cycle: 15,
w_compound: 50,
w_var: 10, % leaf-type weights
w_atom: 10,
w_int: 10,
w_float: 10,
w_rational: 10,
w_string: 10
}