Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
make rdd count be n
  • Loading branch information
yanghaogn authored Jun 26, 2016
commit f91e55eb6a9c81189292989a40d9a4e76dc9309c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object SparkPi {
.getOrCreate()
val slices = if (args.length > 0) args(0).toInt else 2
val n = math.min(100000L * slices, Int.MaxValue).toInt // avoid overflow
val count = spark.sparkContext.parallelize(1 until n, slices).map { i =>
val count = spark.sparkContext.parallelize(1 to n, slices).map { i =>
val x = random * 2 - 1
val y = random * 2 - 1
if (x*x + y*y < 1) 1 else 0
Expand Down