I have a random number class which generate the random number.However i want it to be Initiate as class member so that we do not need to regenerate in every call.Below is the code at present.
import ml.combust.mleap.core.Model
import ml.combust.mleap.core.types._
case class RandomNumberModel() extends Model{
def apply(input: String): Double = {
val rnd = scala.util.Random
return rnd.nextFloat
}
override def inputSchema: StructType = StructType("input" -> ScalarType.String).get
override def outputSchema: StructType = StructType("output" -> ScalarType.Double ).get
}
I am new to scala need suggestion What changes i have to do here ?