doc-exports/docs/dli/sqlreference/dli_spark_rand.html
Su, Xiaomeng 76a5b1ee83 dli_sqlreference_20240227
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2024-03-27 22:02:33 +00:00

3.9 KiB

rand

This function is used to return an evenly distributed random number that is greater than or equal to 0 and less than 1.

Syntax

rand(INT seed)

Parameters

Table 1 Parameter

Parameter

Mandatory

Type

Description

seed

No

INT

The value can be a float, integer, or string.

If this parameter is specified, a stable random number sequence is obtained within the same running environment.

Return Values

The return value is of the DOUBLE type.

Example Code

The value 0.3668915240363728 is returned.

select rand();

The value 0.25738143505962285 is returned.

select rand(3);