Skip to content

Commit

Permalink
fix #7613
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdraves committed Jun 30, 2018
1 parent 4a6bb1e commit 2f6083c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/scala/SparkUI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@
"outputs": [],
"source": [
"val NUM_SAMPLES = 10000000\n",
"\n",
"val count2 = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n",
" val x = Math.random()\n",
" val y = Math.random()\n",
"val random = new scala.util.Random()\n",
"val count = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n",
" val x = random.nextDouble()\n",
" val y = random.nextDouble()\n",
" if (x*x + y*y < 1) 1 else 0\n",
"}.reduce(_ + _)\n",
"\n",
"println(\"Pi is roughly \" + 4.0 * count2 / NUM_SAMPLES)"
"println(\"Pi is roughly \" + 4.0 * count / NUM_SAMPLES)"
]
},
{
Expand Down

0 comments on commit 2f6083c

Please sign in to comment.