ray.data.expressions.RandomExpr#

class ray.data.expressions.RandomExpr(seed: int | None = None, reseed_after_execution: bool = True, _instance_id: str = ...)[source]#

Bases: Expr

Expression that represents a random number generation operation.

Parameters:
  • seed – The seed to use for the random number generator.

  • reseed_after_execution – Whether to reseed the random number generator after each execution. This parameter is ignored when seed is None.

Example

>>> from ray.data.expressions import random
>>> random()
RANDOM()
>>> random(seed=1234)
RANDOM(seed=1234, reseed_after_execution=True)

DeveloperAPI: This API may change across minor Ray releases.

Methods

abs

Compute the absolute value of the expression.

acos

Compute the arccosine (inverse cosine) of the expression, returning radians.

alias

Rename the expression.

asin

Compute the arcsine (inverse sine) of the expression, returning radians.

atan

Compute the arctangent (inverse tangent) of the expression, returning radians.

cast

Cast the expression to a specified type.

ceil

Round values up to the nearest integer.

cos

Compute the cosine of the expression (in radians).

exp

Compute the natural exponential of the expression.

floor

Round values down to the nearest integer.

is_in

Check if the expression value is in a list of values.

is_not_null

Check if the expression value is not null.

is_null

Check if the expression value is null.

ln

Compute the natural logarithm of the expression.

log10

Compute the base-10 logarithm of the expression.

log2

Compute the base-2 logarithm of the expression.

negate

Compute the negation of the expression.

not_in

Check if the expression value is not in a list of values.

power

Raise the expression to the given power.

round

Round values to the nearest integer using PyArrow semantics.

sign

Compute the sign of the expression.

sin

Compute the sine of the expression (in radians).

tan

Compute the tangent of the expression (in radians).

to_pyarrow

Convert this Ray Data expression to a PyArrow compute expression.

trunc

Truncate fractional values toward zero.

Attributes

arr

Access array operations for this expression.

dt

Access datetime operations for this expression.

list

Access list operations for this expression.

map

Access map/dict operations for this expression.

name

Get the name associated with this expression.

reseed_after_execution

seed

str

Access string operations for this expression.

struct

Access struct operations for this expression.

data_type