generating random tree