# Error occurring from p.431 code, Swift 4 Version

**URL:** <https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467>\
**Category:** 2D iOS & tvOS Games by Tutorials\
**Created:** [November 11, 2017, 1:04am UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467 "2017-11-11T01:04:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![salanthonyc](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@salanthonyc](https://forums.kodeco.com/u/salanthonyc)\
**Post date:** [November 11, 2017, 1:04am UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/1 "2017-11-11T01:04:58Z")

</div>

When I add the code at the top of page 431, I get an error saying:

Type ‘Int’ has no member ‘random’

Any suggestions?

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [November 11, 2017, 2:29am UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/2 "2017-11-11T02:29:32Z")

</div>

Do you have SKUtils included in your project and your target?

`Int+Extensions.swift` has a `random(_:)` function that extends `Int`

---

<div class="post-metadata">

**Author:** ![salanthonyc](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@salanthonyc](https://forums.kodeco.com/u/salanthonyc)\
**Post date:** [November 11, 2017, 5:09pm UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/3 "2017-11-11T17:09:47Z")

</div>

Do you mean SKTUtils?

---

<div class="post-metadata">

**Author:** ![salanthonyc](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@salanthonyc](https://forums.kodeco.com/u/salanthonyc)\
**Post date:** [November 11, 2017, 5:29pm UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/4 "2017-11-11T17:29:50Z")

</div>

SKTUtils was included in the file but not the target. After manually adding it the target, the error went away. Thank you.

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [November 12, 2017, 1:17am UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/5 "2017-11-12T01:17:02Z")

</div>

@salanthonyc - Yes I did mean SKTUtils. Glad you got it fixed.

Xcode 9 has an annoying habit of sometimes not adding imported files to the targets, and of course if the files aren’t included in the target, then they’re not included in your app. Watch out especially for images not importing, as they won’t cause a compile time error.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [April 26, 2018, 5:05pm UTC](https://forums.kodeco.com/t/error-occurring-from-p-431-code-swift-4-version/36467/6 "2018-04-26T17:05:00Z")

</div>

Closed on April 26, 2018, 5:05pm UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
