bigframes.bigquery.rand#

bigframes.bigquery.rand() Expression[source]#

Generates a pseudo-random value of type FLOAT64 in the range of [0, 1), inclusive of 0 and exclusive of 1.

Warning

This method introduces non-determinism to the expression. Reading the same column twice may result in different results. The value might change. Do not use this value or any value derived from it as a join key.

Examples:

>>> import bigframes.pandas as bpd
>>> import bigframes.bigquery as bbq
>>> df = bpd.DataFrame({"a": [1, 2, 3]})
>>> df['random'] = bbq.rand()
>>> # Resulting column 'random' will contain random floats between 0 and 1.
Returns:

An expression that can be used in assign() and other methods. See bigframes.pandas.col().

Return type:

bigframes.pandas.api.typing.Expression