-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f564c9e
commit c58c2cd
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// EDFuzz.h | ||
// connect | ||
// | ||
// Created by Andrew Sliwinski on 9/7/12. | ||
// Copyright (c) 2012 DIY, Co. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface EDFuzz : NSObject | ||
|
||
+ (NSString *)withLength:(NSUInteger)length; | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// EDFuzz.m | ||
// connect | ||
// | ||
// Created by Andrew Sliwinski on 9/7/12. | ||
// Copyright (c) 2012 DIY, Co. All rights reserved. | ||
// | ||
|
||
#import "EDFuzz.h" | ||
|
||
@implementation EDFuzz | ||
|
||
+ (NSString *)withLength:(NSUInteger)length | ||
{ | ||
NSString *alphabet = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZY0123456789!@#$%^&*()_+{}|][=-';:`~? "; | ||
NSMutableString *s = [NSMutableString stringWithCapacity:length]; | ||
for (NSUInteger i = 0U; i < length; i++) { | ||
u_int32_t r = arc4random() % [alphabet length]; | ||
unichar c = [alphabet characterAtIndex:r]; | ||
[s appendFormat:@"%C", c]; | ||
} | ||
|
||
return s; | ||
} | ||
|
||
@end |