//
// RandomUtils.m
// Project
//
// Created by haibara on 9/19/16.
//
//

#import "RandomUtils.h"
#import "SDK.h"

@implementation RandomUtils

+ (BOOL)nextBoolean {
	return arc4random_uniform(2) == 1;
}

+ (CLLocationCoordinate2D)nextCoordinate:(CLLocationCoordinate2D)coordinate {
	return CLLocationCoordinate2DMake(coordinate.latitude + ([self nextBoolean] ? 1 : -1) * (arc4random_uniform(1000) / powf(10, 6)), coordinate.longitude + ([self nextBoolean] ? 1 : -1) *  (arc4random_uniform(1000) / powf(10, 6)));
}

+ (UIColor *)nextColor {
	return [UIColor im_colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:1];
}

+ (FAKIcon *)nextIcon:(CGFloat)size {
	Class class = NSClassFromString([self nextObject:@[@"FAKFontAwesome",@"FAKFoundationIcons",@"FAKIonIcons",@"FAKMaterialIcons",@"FAKOcticons",@"FAKZocial"]]);
	return [class iconWithCode:[self nextObject:[class allIcons].allValues] size:size];
}

+ (id)nextObject:(NSArray *)objects {
	return objects.count > 0 ? objects[arc4random_uniform((u_int32_t)objects.count)] : nil;
}

@end
