pyspark.sql.functions.
randn
Generates a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
seed value for random generator.
Column
random values.
Notes
The function is non-deterministic in general case.
Examples
>>> df = spark.range(2) >>> df.withColumn('randn', randn(seed=42)).show() +---+--------------------+ | id| randn| +---+--------------------+ | 0|-0.04167221574820542| | 1| 0.15241403986452778| +---+--------------------+