Skip to content

chris-huxtable/CBHRandomKit

Repository files navigation

CBHRandomKit

release pod licence coverage

An easier and safer to use interface for good, cryptographically secure, random.

Use

CBHRandom provides class methods for producing random data of fixed and variable length with bounding constraints.

Example:

Generate a random NSUInteger:

NSUInteger randInt = [CBHRandom randomUnsignedInteger];

Generate a random NSUInteger less then 128 inclusive:

NSUInteger randInt = [CBHRandom randomUnsignedIntegerWithBound:128];

Generate a random NSUInteger between 64 and 128 inclusive:

NSUInteger randInt = [CBHRandom randomIntegerBetweenLower:64 andUpperBound:128];

Shuffling an Array:

NSArray *array = @[@1, @2, @3, @4, @5];
NSArray *shuffledArray = [array arrayByShuffling];

Shuffling an Array in-place:

NSMutableArray *array = [NSMutableArray arrayWithObjects:@1, @2, @3, @4, @5, nil];
[array shuffle];

Requesting a random object from Array:

NSArray *array = @[@1, @2, @3, @4, @5];
NSNumber *number = [array randomObject];

Licence

CBHRandomKit is available under the ISC license.

About

An easier & safer to use interface for cryptographically secure random.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy