com.mitteloupe.randomgenkt.fielddataprovider.DoubleFieldDataProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of randomgenkt Show documentation
Show all versions of randomgenkt Show documentation
Initialize instances of any class with generated data.
The newest version!
package com.mitteloupe.randomgenkt.fielddataprovider
import com.mitteloupe.randomgenkt.FieldDataProvider
import java.util.Random
class DoubleFieldDataProvider(
private val random: Random,
private val minimum: Double = 0.0,
private val maximum: Double = 1.0
) : FieldDataProvider() {
override fun invoke(instance: OUTPUT_TYPE?) =
random.nextDouble() * (maximum - minimum) + minimum
}