The following awk one-liner returns $ntree
NEWICK-formatted rooted phylogenetic tree topologies (i.e. without branch length) on $ntax
leaves generated following the Yule-Harding model of speciation (e.g. Harding 1971, Steel and McKenzie 2001) from the integer seed $seed
:
The following awk one-liner returns $ntree
NEWICK-formatted rooted phylogenetic trees on $ntax
leaves with topologies generated following the Yule-Harding model of speciation (e.g. Harding 1971, Steel and McKenzie 2001) and branch lengths randomly drawn from 0 to $maxlgt
from the integer seed $seed
:
awk -v n=$ntax -v m=$maxlgt -v r=$ntree -v s=$seed 'BEGIN{srand(s);while(--r>=0){t="(t1:,t2:);";i=1;while(++i<n)sub("t"(j=int(i*rand())+1)":","(t"j":,t"(i+1)":):"sprintf("%.8f",m*rand()),t);i=0;while(++i<=n)sub("t"i":","t"i":"sprintf("%.8f",m*rand()),t);print t}}'