change ratio from Int to Double.

Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/244a93a9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/244a93a9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/244a93a9

Branch: refs/heads/master
Commit: 244a93a99f545d019b016b567c2f35ff051c9548
Parents: 3f31309
Author: daewon <[email protected]>
Authored: Fri Jun 24 10:30:50 2016 +0900
Committer: DO YUNG YOON <[email protected]>
Committed: Thu Nov 10 21:43:33 2016 +0900

----------------------------------------------------------------------
 .../apache/s2graph/rest/play/controllers/EdgeController.scala    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/244a93a9/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala
----------------------------------------------------------------------
diff --git 
a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala 
b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala
index b78b778..da88c3d 100644
--- 
a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala
+++ 
b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala
@@ -58,8 +58,8 @@ object EdgeController extends Controller {
             (walLogOpt \ "method").as[JsValue] match {
               case JsString("drop") => // pass
               case JsString("sample") =>
-                val rate = (walLogOpt \ "rate").as[Int]
-                if (Random.nextInt(100) < rate) enqueue(kafkaTopic, e, tsv)
+                val rate = (walLogOpt \ "rate").as[Double]
+                if (scala.util.Random.nextDouble() < rate) enqueue(kafkaTopic, 
e, tsv)
               case _ => enqueue(kafkaTopic, e, tsv)
             }
         }

Reply via email to