## 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.

# breakpoint Int

I have a question about the randomFact function. When I run my code I get a breakpoint error at the

```    let randomNumber = Int(unsignedRandomNumber)
```

It seems that when I return

```factsArray[randomNumber]
```

I get a number like 140734746147408. I looked through my breakpoint error and it shows me that the

```unsignedArrayCount = 10
unsignedRandomNumber = 8
```

but my

```randomNumber = 140734746147408
```

Hello Thomas :

```  struct FactBook {
let factsArray = ["Array with 10 things in it"]

func randomFact() -> String {
let unsignedArrayCount = factsArray.count
let unsignedRandomNumber = arc4random_uniform(UInt32(unsignedArrayCount))
let randomNumber = Int(unsignedRandomNumber)
return factsArray[randomNumber]
}
}
```

This is what it looks like. Like I said the breakpoint error says unsignedArrayCount = 10, unsignedRandomNumber = {8}, and randomNumber = 140734746147408. Not sure what is going on here

Everything looks fine to me, but try this and see how it behaves. It shouldn't behave any different, since it's basically the same thing. But it's worth giving it a try.

```struct FactBook {
let factsArray = ["Array with 10 things in it"]

func randomFact() -> String {
let unsignedArrayCount = UInt32(factsArray.count)
let unsignedRandomNumber = arc4random_uniform(unsignedArrayCount)
let randomNumber = Int(unsignedRandomNumber)

return factsArray[randomNumber]
}
}
```

If that does not work let me know, and we can look deeper into it.

I used your code in my sample of the same app, and it worked perfectly.

I changed the code to what you said and it still didn't work. But I decided to just start over and make a new projects and now it seems to work the only difference from my last one is I changed the type of phone to used in the simulator. The video says to use iPhone 5 but I used iPhone 6s. I don't know what happened but it works. Thanks a lot Jhoan.