implement random trees