So i have simple class named Person
, this class have several fields:
class person {
val name:String
val abe:Int
def generateRandom(): Person {
// Here i want to generate Person and return
}
}
So as you can see i want my class will have the option to generate random
Person
but i don't want to pass any params to my class, i want it to be auto.
So how can i create new Person
object inside this generateRandom
method and return it with both name
and age
fields ?
Any suggestions how to implement it ?