Spark中的takeSample()函数

Pra*_*rni 7 random scala seeding

我正在尝试使用Spark中takeSample()函数,参数是 - 数据,要采取的样本数和种子.但我不想使用种子.我想每次都有不同的答案.我无法弄明白我该怎么做.我尝试使用作为种子值,但它给出了一个错误,因为我认为数据类型不匹配.是否有其他类似的功能可以在没有种子的情况下使用?或者我可以使用任何其他实现,以便每次都获得不同的输出.System.nanoTimetakeSample()takeSample()

Mal*_*off 8

System.nanoTime属于类型long,期望的种子takeSample是类型Int.因此,takeSample(..., System.nanoTime.toInt)应该工作.