Skip to content

Commit 3b14d74

Browse files
committed
Batch Merkle Proof revert Random.between()
1 parent 8d45697 commit 3b14d74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/scala/scorex/crypto/authds/merkle/MerkleTreeSpecification.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ class MerkleTreeSpecification extends AnyPropSpec with ScalaCheckDrivenPropertyC
5050
}
5151

5252
property("Batch proof generation by indices") {
53+
val r = new Random()
5354
forAll(smallInt) { N: Int =>
5455
whenever(N > 0) {
5556
val d = (0 until N).map(_ => LeafData @@ scorex.utils.Random.randomBytes(LeafSize))
5657
val tree = MerkleTree(d)
57-
val randIndices = (0 until Random.between(1, N + 1))
58-
.map(_ => Random.between(0, N))
58+
val randIndices = (0 until r.nextInt(N + 1) + 1)
59+
.map(_ => r.nextInt(N))
5960
.distinct
6061
.sorted
6162
tree.proofByIndices(randIndices).get.valid(tree.rootHash) shouldBe true

0 commit comments

Comments
 (0)