rand
function
Applies to: Databricks SQL Databricks Runtime
Returns a random value between 0 and 1. This function is a synonym for random function.
Syntax
rand( [seed] )
Arguments
seed
: An optionalINTEGER
literal.
Returns
A DOUBLE
.
The function generates pseudo random results with independent and identically distributed (i.i.d.) uniformly distributed values in [0, 1).
This function is non-deterministic.
Examples
> SELECT rand();
0.9629742951434543
> SELECT rand(0);
0.8446490682263027
> SELECT rand(null);
0.8446490682263027
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for