Skip to content

Commit e4dfcf5

Browse files
author
Antoine Brunner
committed
Seed random generator for more constant results
1 parent 4fad817 commit e4dfcf5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

bench-run/src/main/scala/dotty/tools/benchmarks/tuples/TupleOps.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class TupleOps {
1919
for (i <- 1 until 10)
2020
tuple2 = s"elem$i" *: tuple2
2121

22-
tuple3 = Tuple.fromArray(Random.shuffle(1 to 15).toArray)
22+
val rand = new Random(12345)
23+
tuple3 = Tuple.fromArray(rand.shuffle(1 to 15).toArray)
2324
}
2425

2526
def tupleFlatMap(tuple: Tuple, f: [A] => A => Tuple): Tuple = {

library/src/scala/runtime/DynamicTuple.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ object DynamicTuple {
240240
res.asInstanceOf[Result]
241241
}
242242

243-
def dynamicApply[This <: NonEmptyTuple, N <: Int] (self: This, n: Int): Elem[This, N] = {
243+
def dynamicApply[This <: NonEmptyTuple, N <: Int] (self: This, n: N): Elem[This, N] = {
244244
type Result = Elem[This, N]
245245
val res = (self: Any) match {
246246
case self: Unit => throw new IndexOutOfBoundsException(n.toString)

0 commit comments

Comments
 (0)