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 59b4ae1

Browse files
committed
Fix bug for charSet2
count can be 256, which won’t fit in an UInt8
1 parent 43f425e commit 59b4ae1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Sources/Random.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public class Random {
128128
guard needed <= bytes.count else { throw EntropyStringError.tooFewBytes }
129129

130130
let chunks = count / Int(charSet.charsPerChunk)
131-
let partials = UInt8(count) % charSet.charsPerChunk
131+
let partials = UInt8(count % Int(charSet.charsPerChunk))
132132

133133
var string = ""
134134
for chunk in 0 ..< chunks {

0 commit comments

Comments
(0)

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