vendredi 1 mai 2015

Generating two different random number simultaneously in Scala - Spark

Anybody can help in generating two different random numbers in their ranges

my code is

 var a = Random.nextInt(S)
 var b = Random.nextInt(K)
        if (a == S || b == K){
          a = S-1
          b = K-1
        }
 (word,a,b)

but it generates some numbers that are not in specified ranges.




Aucun commentaire:

Enregistrer un commentaire