samedi 3 octobre 2020

Difference between math.random and Random.nextDouble in Scala

I Scala random double number can be generated in following ways.

import scala.util.Random
val rnd = new Random
val rndomNumber1 = rnd.nextDouble

Second way is

val rndomNumber2 = math.random

What is difference between these two methods? Both of these are generating random number in range [0,1].




Aucun commentaire:

Enregistrer un commentaire