fix random failing test (#77)

This commit is contained in:
Dmitriy Ryajov 2022-04-07 17:08:43 -06:00 committed by GitHub
parent aa50127c14
commit 2e8b39cf7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -211,7 +211,13 @@ suite "Erasure encode/decode":
blockIdx = toSeq(countup(offset, encoded.len - 1, encoded.steps))
for _ in 0..<encoded.M + 1: # NOTE: the +1
blocks.add(rng.sample(blockIdx, blocks))
var idx: int
while true:
idx = rng.sample(blockIdx, blocks)
if not encoded[idx].isEmpty:
break
blocks.add(idx)
offset.inc
for idx in blocks: