>>> df.show()
+---+----+------------+
|id |num1|numbers     |
+---+----+------------+
|1  |100 |[12, 23, 45]|
|2  |200 |[67]        |
|3  |300 |[12]        |
|4  |400 |[98, 54]    |
+---+----+------------+

PySpark code

>>> df.select(F.shuffle(F.array_distinct(F.col("numbers"))).alias("shuffled_numbers")).show()
+-----------------+
|shuffled_numbers |
+-----------------+
|[23, 12, 45]     |
|[67]             |
|[12]             |
|[54, 98]         |
+-----------------+

teradatamlspk code

# Remove duplicates from numbers array
>>> temp_df = df.withColumn("distinct_numbers", F.array_distinct(F.col("numbers")))

# Shuffle the distinct array
>>> temp_df.select(F.shuffle(F.col("distinct_numbers")).alias("shuffled_numbers")).show()
+----------------+
|shuffled_numbers|
+----------------+
|         (54,98)|
|            (67)|
|      (45,12,23)|
|            (12)|
+----------------+