GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bryanluby/NSArray-Shuffle: NSArray category for shuffling arrays.

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
NSArray+Shuffle.h
NSArray+Shuffle.h
 
 
NSArray+Shuffle.m
NSArray+Shuffle.m
 
 
README.md
README.md
 
 

Repository files navigation

NSArray-Shuffle

NSArray category for shuffling arrays.

Methods

bjl_shuffledArray

- (NSArray *)bjl_shuffledArray

Return Value

Returns an array where all elements are shuffled into random order.

bjl_shuffledArrayWithItemLimit:

- (NSArray *)bjl_shuffledArrayWithItemLimit:(NSUInteger)itemLimit

Parameters

itemLimit

The number of elements to randomly select from the array.

Return Value

Returns an array with a limited number of random elements.

Discussion

This method will improve performance if you only need a few elements out of a large dataset.

Usage

Add the NSArray+Shuffle.h and NSArray+Shuffle.m files to your Xcode project.

Information

This category implements the Fisher-Yates shuffle algorithm and uses the arc4random_uniform random number generator.

Helpful reference articles on array shuffling:

Fisher–Yates shuffle - Wikipedia, the free encyclopedia

Coding Horror: The Danger of Naïveté

Eli Bendersky's website » The intuition behind Fisher-Yates shuffling

License

MIT License

About

NSArray category for shuffling arrays.

Resources

Readme
MIT license
Activity

Stars

20 stars

Watchers

2 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.