Skip to content

Commit

Permalink
EDFuzz class
Browse files Browse the repository at this point in the history
  • Loading branch information
thisandagain committed Sep 7, 2012
1 parent f564c9e commit c58c2cd
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
15 changes: 15 additions & 0 deletions EDAssert/EDFuzz.h
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
26 changes: 26 additions & 0 deletions EDAssert/EDFuzz.m
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

0 comments on commit c58c2cd

Please sign in to comment.