fixes RandomChunker not respecting padding (#1170)

This commit is contained in:
Marcin Czenko 2025-03-31 06:48:22 +02:00 committed by GitHub
parent 0032e60398
commit 0ec52abc98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,10 +33,10 @@ proc new*(
return 0
var read = 0
while read < len:
while read < len and (pad or read < size - consumed):
rng.shuffle(alpha)
for a in alpha:
if read >= len:
if read >= len or (not pad and read >= size - consumed):
break
data[read] = a