瀏覽代碼

Merge pull request #1935 from zloster/scruffy-10000-inclusive-random

Changed the range of the id
ssmith-techempower 9 年之前
父節點
當前提交
eea1923a3a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala

+ 1 - 1
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala

@@ -21,7 +21,7 @@ object Test2Endpoint extends HttpModule {
   //  collection.save(DBObject("_id" -> k, "id" -> k, "randomNumber" -> random.nextInt(10000).toDouble))
 
   get("db") { req =>
-    val id = ThreadLocalRandom.current.nextInt(10000)
+    val id = 1 + ThreadLocalRandom.current.nextInt(10000)
     val dbo = collection.findOne(DBObject("_id" -> id), fields)
     val randomNumber = Math.round(dbo.get("randomNumber").toString.toFloat)
     Output(id, randomNumber).json