Created
February 25, 2016 14:37
-
-
Save irpainel-zz/831472552f143589cc43 to your computer and use it in GitHub Desktop.
Guide Utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(BOOL)randomBool { | |
int tmp = (arc4random() % 30)+1; | |
if(tmp % 5 == 0) | |
return YES; | |
return NO; | |
} | |
+(int)randomNumberInRangeMin:(int)min max:(int)max { | |
return rand() % (max - min) + min; | |
} | |
+(NSString *)randomPlaceholderUrlWithWidth:(NSInteger)width height:(NSInteger)height { | |
unsigned int baseInt = arc4random() % 0xFFFFFF; | |
NSString *backgroundHex = [NSString stringWithFormat:@"%06X", baseInt]; | |
NSString *textHex = @"ffffff"; | |
return [NSString stringWithFormat:@"https://placehold.it/%dx%d/%@/%@",(int)width, (int)height, backgroundHex, textHex]; | |
} | |
+(NSString *)randomPlaceholderImageUrlWithWidth:(NSUInteger)width height:(NSInteger)height { | |
return [NSString stringWithFormat:@"https://unsplash.it/%d/%d/?random",(int)width, (int)height]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment