import java.util.Random
import org.apache.spark.util.random.XORShiftRandom
import scala.util.hashing
def distribution(count: Int, partition: Int) = {
println((1 to count).map(partitionId => new Random(partitionId).nextInt(partition))
.groupBy(f => f)
.map(_._2.size).mkString(". "))
println((1 to count).map(partitionId => new Random(hashing.byteswap32(partitionId)).nextInt(partition))
.groupBy(f => f)
.map(_._2.size).mkString(". "))
println((1 to count).map(partitionId => new XORShiftRandom(partitionId).nextInt(partition))
.groupBy(f => f)
.map(_._2.size).mkString(". "))
}
distribution(200, 4)