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


richard barnes
richard barnes
2,949 Points

A swift problem: randomising linked arrays?

Hi, I've been trying to figures this out for a couple of weeks but still no luck I can't work out whether or not I should be trying to work with multidimensional arrays, dictionaries or something I haven't learnt about yet. Essentially what I'm trying to do is to have a random string to appear in a table view label and then have it randomise a second string dependent on the first. I'd like that displayed it in a second label in the same table view cell.

for example:

cake: one, two, three four; sandwich: five, six, seven; chocolate: eight, nine ten;

So when I press a button the first "lead" item is randomised and then it's associated array is randomised.

so it could say: Sandwich in one label and six in the second.

Any advice is greatly appreciated.