---
title: randomSource
framework: gameplaykit
role: symbol
role_heading: Instance Property
path: gameplaykit/gkdecisiontree/randomsource
---

# randomSource

The randomizer to be used when evaluating parts of the tree that branch randomly.

## Declaration

```swift
@NSCopying var randomSource: GKRandomSource { get set }
```

## Discussion

Discussion Some of the branches in a decision tree may not depend on an external input; instead, when evaluating the tree with the findAction(forAnswers:) method, the tree automatically chooses an answer at random. (In a manually created decision tree, you can create random branches with the createBranch(weight:attribute:) method.) The tree uses this random source when randomly choosing answers.

## See Also

### Evaluating a Tree to Make Decisions

- [findAction(forAnswers:)](gameplaykit/gkdecisiontree/findaction(foranswers:).md)
