Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f258e8b

Browse files
committed
Add string override
Missed when adding CharSet per call overrides
1 parent b46343a commit f258e8b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎Sources/Random.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ public class Random {
180180
return string(bits: bits, secRand: &secRand)
181181
}
182182

183+
/// Generates a random string.
184+
///
185+
/// - parameter bits: Minimum bits of entropy.
186+
///
187+
/// - return: A string. The returned string's entropy is a multiple of the _entropy per char_
188+
/// for the character set in use. The entropy returned is the smallest such multiple larger
189+
/// than `bits`.
190+
public func string(bits: Float, charSet: CharSet) -> String {
191+
var secRand = true
192+
return string(bits: bits, charSet: charSet, secRand: &secRand)
193+
}
194+
183195
/// Generates a random string.
184196
///
185197
/// - parameter bits: Minimum bits of entropy.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /