---
title: "addSubtree(_:weight:)"
framework: phase
role: symbol
role_heading: Instance Method
path: "phase/phaserandomnodedefinition/addsubtree(_:weight:)"
---

# addSubtree(_:weight:)

Adds a node tree that’s one of the random-selection options.

## Declaration

```swift
func addSubtree(_ subtree: PHASESoundEventNodeDefinition, weight: NSNumber)
```

## Parameters

- `subtree`: The child node, which itself can contain a hierarchical tree of descendent nodes.
- `weight`: A number that implements favoritism in the random selection.
