获取随机模型

93 阅读3分钟
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface RandomModel : NSObject

//获取随机名字
+ (NSString*)getNameString;

//获取随机头像ID
+ (NSString*)getUserLogoString;

//获取随机头像
+ (NSString*)getImgString:(NSString*)imgId;

@end

NS_ASSUME_NONNULL_END
#import "RandomModel.h"

@implementation RandomModel

//获取随机名字
+ (NSString*)getNameString {
    
    NSArray*nameArray=
    @[@"齐御风",@"无崖子",@"程灵素",@"袁紫衣",
      
      @"苏星河",@"丁春秋",@"任盈盈",@"岳灵珊",
      
      @"阮星竹",@"鸠摩智",@"仪琳",@"曲非烟",
      
      @"邓百川",@"公冶乾",@"苗若兰",@"小龙女",
      
      @"包不同",@"风波恶",@"陆无双",@"李莫愁",
      
      @"吴长风",@"白世镜",@"王语嫣",@"木婉清",
      
      @"马大元",@"全冠清",@"刀白凤",@"秦红棉",
      
      @"王重阳",@"周伯通",@"甘宝宝",@"阿朱",
      
      @"丘处机",@"孙不二",@"阿紫",@"李秋水",
      
      @"黄药师",@"欧阳锋",@"黄蓉",@"穆念慈",
    ];
    
    int textInt = arc4random() % 39;
    return  nameArray[textInt];
    
}

//获取随机头像
+ (NSString*)getUserLogoString {
    
    NSArray*imgArray=
    @[@"2018/03/13/3363a4ad4af427f0",
      @"2018/03/13/222490c377a35860",
      
      @"2018/03/11/bcf4295f7cad7252",
      @"2018/03/11/b9d60eadd4d0aba1",
      
      @"2018/03/13/f01516c27dd92dfe",
      @"2018/03/13/fbb7cad30d8a027f",
      
      @"2018/03/11/dfefacf94b8d7b2c",
      @"2018/03/11/75bbde7c8cac2d2e",
      
      @"2018/03/13/37e8da908b6e1a00",
      @"2018/03/13/4bc4471d12eb49c5",
      
      @"2018/03/11/bcf4295f7cad7252",
      @"2018/03/11/a0a5def8fc4d4377",
      
      @"2018/03/13/60c54ef5d58e358c",
      @"2018/03/13/1a86eb1325a1db6c",
      
      @"2018/03/11/4f3687b67cd91877",
      @"2018/03/11/6c0ee5aacf392745",
      
      @"2018/03/10/cda1898852d63320",
      @"2018/03/10/e5c4d29fe60da63e",
      
      @"2018/03/11/b0f923cb4b436bab",
      @"2018/03/11/219ef1aa7681ceb2",
      
      @"2018/03/08/cfc26fb2c53a53ee",
      @"2018/03/08/2dd93cb689c90023",
      
      @"2018/03/11/025f7a0c8544d989",
      @"2018/03/11/9601f07169b40818",
      
      @"2018/03/11/067c671436279aba",
      @"2018/03/08/8ad82a98e49a6649",
      
      @"2018/03/11/067c671436279aba",
      @"2018/03/11/cb7f1ede2995fe12",
      
      @"2018/03/08/62af01905686c8e6",
      @"2018/03/08/1cfe0644ace95555",
      
      @"2018/03/11/d974cb17d0a82c4f",
      @"2018/03/11/c4369b1489e0e431",
      
      @"2018/03/08/709279000ba3dc34",
      @"2018/03/08/f2418948c2fc630c",
    ];
    
    int textInt = arc4random() % 33;
    NSString*imgId=imgArray[textInt];
    
    return  imgId;
}

+ (NSString*)getImgString:(NSString*)imgId {
    return  [NSString stringWithFormat:@"http://img2.woyaogexing.com/%@!400x400_big.jpg",imgId];
}

@end