mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-04-12 23:42:03 -04:00
Update random generator reference
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
parent
0d33f51f9e
commit
30bb26473e
@ -4,6 +4,7 @@ import lc.database.Statements
|
||||
import java.util.concurrent.{ScheduledThreadPoolExecutor, TimeUnit}
|
||||
import lc.core.{Captcha, Config}
|
||||
import lc.core.{Parameters, Size}
|
||||
import lc.misc.HelperFunctions
|
||||
|
||||
class BackgroundTask(throttle: Int, timeLimit: Int) {
|
||||
|
||||
@ -39,7 +40,7 @@ class BackgroundTask(throttle: Int, timeLimit: Int) {
|
||||
}
|
||||
|
||||
private def pickRandom[T](list: List[T]): T = {
|
||||
list(Config.getNextRandomInt(list.size))
|
||||
list(HelperFunctions.randomNumber(list.size))
|
||||
}
|
||||
|
||||
def beginThread(delay: Int): Unit = {
|
||||
|
@ -4,6 +4,7 @@ import lc.captchas._
|
||||
import lc.captchas.interfaces.ChallengeProvider
|
||||
import lc.captchas.interfaces.Challenge
|
||||
import scala.collection.mutable.Map
|
||||
import lc.misc.HelperFunctions
|
||||
|
||||
object CaptchaProviders {
|
||||
private val providers = Map(
|
||||
@ -51,7 +52,7 @@ object CaptchaProviders {
|
||||
def getProvider(param: Parameters): Option[ChallengeProvider] = {
|
||||
val providerConfig = filterProviderByParam(param).toList
|
||||
if (providerConfig.length > 0) {
|
||||
val randomIndex = Config.getNextRandomInt(providerConfig.length)
|
||||
val randomIndex = HelperFunctions.randomNumber(providerConfig.length)
|
||||
val providerIndex = providerConfig(randomIndex)._1
|
||||
val selectedProvider = providers(providerIndex)
|
||||
selectedProvider.configure(providerConfig(randomIndex)._2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user