Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:32:26+00:00 2026-06-06T22:32:26+00:00

I want to show array objects at the same time in different 10 labels.

  • 0

I want to show array objects at the same time in different 10 labels. They should be align random for every time. How can I do that?

I’ve done the random part:

srandom(time(NULL));
NSUInteger arr = [myarray count];
for (NSUInteger i = 0; i < arr; ++i) {
    int nElements = arr - i;
    int n = (random() % nElements) + i;
    [myarray exchangeObjectAtIndex: i withObjectAtIndex:n];
}

But when I want to use the code below to 10 different labels, array objects repeat, and 2 or 3 different labels can have the same value. How can I make them different?

myLabel.text = [NSString stringWithFormat:@"%@", [[arr objectAtIndex:(random()%9)+1]intValue];

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:32:29+00:00Added an answer on June 6, 2026 at 10:32 pm

    As you are uses the random() method to randomise the objects into array then no need to use the random() for displaying the data in labels as in randome method some returned data can be repeatedly returned so this happens just use random() for randomize the data and serially show them in labels using simple for loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have array of objects with created images (Object.Image), i want to show images
I have several distinct View objects, stored in the views array, that I want
I want to send array of my own objects to JSP page by request.
I have an array of objects with different properties and I need to filter
When trying to stringify an object that holds an array of objects, I'm getting
I want show an information page after success db opartions. And after the info
I want show annotation view (above one of my pin) after load map. For
hii I want show a pop up Dialog box when i click on to
I'm using Drupal 7 and Views module in my site. And want show number
I want to show a border type look for an element but without using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.