It sounds like what you want is really a random permutation of the number 1..N. So, fill an array with consecutive integers 1..N and then shuffle the array. There are well known algorithms for shuffling that you can look up.
More Related Contents:
- How dangerous is it to compare floating point values?
- What does the question mark and the colon (?: ternary operator) mean in objective-c?
- How to write iOS app purely in C
- Combine static libraries on Apple
- Declaring variables inside a switch statement [duplicate]
- Why write 1,000,000,000 as 1000*1000*1000 in C?
- Dot (“.”) operator and arrow (“->”) operator use in C vs. Objective-C
- Why does rand() % 7 always return 0?
- What is a fast C or Objective-C math parser? [closed]
- What is “->” in Objective C?
- How is this form of scoping called? [duplicate]
- How does rand() work? Does it have certain tendencies? Is there something better to use?
- Shift hue of an RGB Color
- Is this ternary conditional ?: correct (Objective) C syntax?
- Read data from Excel file in Objective-C (iPhone) [closed]
- Check if object is Class type
- Possible to add another item to an existing enum type?
- How can I use commercial at sign in Objective-C macro?
- 3 questions about extern used in an Objective-C project
- How can I reverse a NSArray in Objective-C?
- What’s the difference between performSelectorOnMainThread: and dispatch_async() on main queue?
- Is it possible to change a UIButtons background color?
- Use regular expression to find/replace substring in NSString
- Git – how do I view the change history of a method/function?
- Format string, integer with leading zeros
- How to use single storyboard uiviewcontroller for multiple subclass
- Can I pass a block as a @selector with Objective-C?
- Handle invalid accessToken with FBSession openActiveSessionWithReadPermissions in Facebook iOS 3.1.1 SDK
- What does having two asterisk ** in Objective-C mean?
- Unable to call an Objective C method from a C function