diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala index 0d6c16d315..12a52148e6 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala @@ -1,17 +1,19 @@ package org.bigbluebutton.core.util +import java.security.SecureRandom + object RandomStringGenerator { // From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ // Random generator - val random = new scala.util.Random + val random = new SecureRandom() // Generate a random string of length n from the given alphabet def randomString(alphabet: String)(n: Int): String = - Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString + LazyList.continually(random.nextInt(alphabet.length)).map(alphabet).take(n).mkString // Generate a random alphabnumeric string of length n - def randomAlphanumericString(n: Int) = + def randomAlphanumericString(n: Int): String = randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) }