Reputation: 1
I'm trying to create a number that's inside of a range with scalacheck generators like:
Gen.chooseNum(min, max)
But it defaults to the increment value of 1
but I wanted it to increment with 0.5
.
What is the solution for this?
Upvotes: 0
Views: 190
Reputation: 693
You can generate integers that are multiples of 5 and then divide them by 10.
Gen.choose(min * 10, max * 10)
.map(_ / 5 * 5)
.map(_.toDouble / 10)
Upvotes: 0