简体   繁体   中英

How can i create a new column in pyspark containing floating random numbers but i want to generate the same no always?

I want create a new column in spark containing floating point random numbers but i want to generate the same output always ie i want to use a fix seed value as 102101.

Try this

from pyspark.sql.functions import rand

df.withColumn('RandomNumber', rand(seed=10))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM