How to generate a list of random numbers?

Ads
 

How to generate a list of random numbers?

Hi,

How to generate a list of random numbers?

I want code in scala programming language.

Thanks

View Answers

November 12, 2017 at 7:13 PM

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









Related Tutorials/Questions & Answers:
How to generate a list of random numbers?
How to generate a list of random numbers?
Advertisements
How to generate a list of random numbers?
How do I generate random number?
How to generate random number in java
ModuleNotFoundError: No module named 'random_string_generate'
ModuleNotFoundError: No module named 'random_string_generate'
Generate random numbers in Java
generate random numbers and display the largest
Generate Random Integer Between Two Values in Scala
Generate Random Integer Between Two Values in Scala
generate random integer matrix in r
Generate random numbers from 1 to 100
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala
Default constructor generate two random equations
Populating a list is Scala with random double
Populating a list is Scala with random double
how to generate auto code ?
how to generate bank account number?
ModuleNotFoundError: No module named 'generate_nsis_file_list'
how to generate udp packets in linux
how to generate udp packets in linux
How to generate XML from XSD?
how to show random image in ASP.net?
how to generate pdf file in struts
how to generate pdf file in struts
How to create a random matrix in r?
J2ME Random Number
how to generate the pdf report from jsp
Version of taglibs>random dependency

Ads