Move number approximation to scalalib

This commit is contained in:
Thibault Duplessis 2012-04-23 19:42:46 +02:00
parent 1a5a299866
commit 2db0ab1a8c
2 changed files with 5 additions and 6 deletions

View file

@ -4,15 +4,14 @@ import akka.util.Duration
import akka.util.duration._
import scala.util.Random
import scala.math.round
import ornicar.scalalib.OrnicarRandom.approximatly
object RichDuration {
implicit def richDuration(d: Duration) = new {
def randomize(ratio: Float = 0.1f): Duration = {
val m = d.toMillis
val m2 = round(m + (ratio * m * 2 * Random.nextFloat) - (ratio * m))
m2 millis
}
def randomize(ratio: Float = 0.1f): Duration =
approximatly(0.1f)(d.toMillis) millis
}
}

View file

@ -14,7 +14,7 @@ trait Dependencies {
val specs2 = "org.specs2" %% "specs2" % "1.8.2"
val casbah = "com.mongodb.casbah" %% "casbah" % "2.1.5-1"
val salat = "com.novus" %% "salat-core" % "0.0.8-SNAPSHOT"
val scalalib = "com.github.ornicar" %% "scalalib" % "1.25"
val scalalib = "com.github.ornicar" %% "scalalib" % "1.27"
val hasher = "com.roundeights" % "hasher" % "0.3" from "http://cloud.github.com/downloads/Nycto/Hasher/hasher_2.9.1-0.3.jar"
val config = "com.typesafe.config" % "config" % "0.3.0"
val json = "com.codahale" %% "jerkson" % "0.5.0"