Skip to content

Commit 636fd45

Browse files
committed
Moved variable outside function.
Unnecessary to recreate var each time.
1 parent bd8bbbe commit 636fd45

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Ternary Search Tree/TST.playground/Contents.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import Cocoa
44
import Foundation
55

66
let treeOfStrings = TernarySearchTree<String>()
7+
let allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
78

8-
//Random string generator from:
9+
//Random string generator from:
910
//http://stackoverflow.com/questions/26845307/generate-random-alphanumeric-string-in-swift/26845710
1011
func randomAlphaNumericString(length: Int) -> String {
11-
12-
let allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
1312
let allowedCharsCount = UInt32(allowedChars.characters.count)
1413
var randomString = ""
1514

0 commit comments

Comments
 (0)