Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Creating a Data Model Finishing Up Our Model

What is the new random number generator as of April 2016?

Neither the arc4random nor arc4random_uniform works and only shows up as an 'unresolved identifier'.

2 Answers

Steven Deutsch
Steven Deutsch
21,046 Points

Hey Matt Capelli,

You can still use arc4random_uniform(). It takes in a UInt32 as its argument.

let randomNumber = arc4random_uniform(UInt32(10))

Good Luck

Mert Kahraman
Mert Kahraman
12,118 Points

Hi,

I'm trying this let randomNumber = arc4random_uniform(UInt32(10)) in the xcode playground, but it keeps giving this error: use of unresolved identifier 'arc4random_uniform'

How should we generate a random number instead?