Builds a dynamic and random tree