Hi,
How to generate a list of random numbers?
I want code in scala programming language.
Thanks
HI,
You can use the code:
Seq.fill(10)(Random.nextInt)
This is example of Scala programming and it generates random integer.
Following program generates 10 random Integers. Here is the sample output:
scala> import scala.util.Random import scala.util.Random
scala> val s = Seq.fill(10)(Random.nextInt) s: Seq[Int] = List(-1181870644, 1222939170, 818784821, 1861087374, 1611361203, 1994029117, -1137498348, 1659383584, -399814242, -1785355400) scala>
Thanks
Ads