Do you mind using this instead? https://github.com/apache/incubator-spark/blob/master/core/src/main/scala/org/apache/spark/util/XORShiftRandom.scala