using properties

This commit is contained in:
michael starke
2017-09-18 11:19:18 +02:00
parent 4dce9ac5d4
commit 25300040d4

View File

@@ -65,7 +65,7 @@ static NSString *mergeWithoutDuplicates(NSString* baseCharacters, NSString* cust
+ (NSString *)passwordFromString:(NSString *)source length:(NSUInteger)length { + (NSString *)passwordFromString:(NSString *)source length:(NSUInteger)length {
NSMutableString *password = [[NSMutableString alloc] initWithCapacity:length]; NSMutableString *password = [[NSMutableString alloc] initWithCapacity:length];
while(password.composedCharacterLength < length) { while(password.composedCharacterLength < length) {
[password appendString:[source randomCharacter]]; [password appendString:source.randomCharacter];
} }
return password; return password;
} }
@@ -78,7 +78,7 @@ static NSString *mergeWithoutDuplicates(NSString* baseCharacters, NSString* cust
allowedCharactersString(allowedCharacters), allowedCharactersString(allowedCharacters),
customCharacters); customCharacters);
while(password.composedCharacterLength < length) { while(password.composedCharacterLength < length) {
NSString *randomCharacter = [characters randomCharacter]; NSString *randomCharacter = characters.randomCharacter;
if(randomCharacter.length > 0) { if(randomCharacter.length > 0) {
[password appendString:randomCharacter]; [password appendString:randomCharacter];
} }