NSObject+YLRandom.m 341 B

1234567891011121314151617
  1. //
  2. // NSObject+YLRandom.m
  3. // mask
  4. //
  5. // Created by 翟玉磊 on 2018/12/9.
  6. // Copyright © 2018 翟玉磊. All rights reserved.
  7. //
  8. #import "NSObject+YLRandom.h"
  9. @implementation NSObject (YLRandom)
  10. + (NSInteger) yl_randomNumber:(NSInteger)from to:(NSInteger)to
  11. {
  12. return (NSInteger)(from + (arc4random() % (to - from + 1)));
  13. }
  14. @end