If you are using Spark-sql your best bet would be to use the inbuilt function
monotonically_increasing_id
which generates unique random id in a separate column.
And as you said you don't need it to be sequential so this should ideally suffice your requirement.