I'm developing genetic algorithm and want to select case class randomly from following

```
sealed abstract class Gene(val code: Int)

object Gene {

  case object None extends Gene(0)

  case object Identity extends Gene(1)

  case object Squared extends Gene(2)

  case object Cubed extends Gene(3)

  case class Exp(a: Double) extends Gene(4)
}

```

How can I list up and select them randomly?

P.S.

Enum can't be used because I will implement parameters and methods to `Gene`

P.S.2

Following is I wrote, it needs manually edit when changing genes but it may be simple solution...

```
def getRandomGene(scaleFactor: Double): Gene = {
  Random.nextInt(5) match {
    case 0 => None
    case 1 => Identity
    case 2 => Squared
    case 3 => Cubed
    case 4 => Exp(scaleFactor / 10 + Random.nextDouble() * 9.9 * scaleFactor)
  }
}

```