pyspark.sql.functions.randn

pyspark.sql.functions.randn(seed: Optional[int] = None) → pyspark.sql.column.Column

Generates a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.

Notes

The function is non-deterministic in general case.

Examples

>>> df.withColumn('randn', randn(seed=42)).collect()
[Row(age=2, name='Alice', randn=1.1027054481455365),
Row(age=5, name='Bob', randn=0.7400395449950132)]