Deden Bangkit Deden Bangkit - 1 year ago 134
Scala Question

Shuffle a List in Scala

I hope you are doing well, I have question to for shuffle list in scala using


for example I have

val a = cyan
val b = magenta
val c = yellow
val d = key

val color = Random.shuffle.List(a,b,c,d).toString //but it doesn't work ;(

so I want the
val color
to be random order of
val a, b, c and d

I believe you guys could do this

Answer Source

User Scala's Random class method shuffle:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download