Skip to contents

Shuffle the elements of a tensor uniformly at random along an axis.

Usage

random_shuffle(x, axis = 1L, seed = NULL)

Arguments

x

The tensor to be shuffled.

axis

An integer specifying the axis along which to shuffle. Defaults to 0.

seed

Optional R integer or instance of random_seed_generator(). By default, the seed argument is NULL, and an internal global random_seed_generator() is used. The seed argument can be used to ensure deterministic (repeatable) random number generation. Note that passing an integer as the seed value will produce the same random values for each call. To generate different random values for repeated calls, an instance of random_seed_generator() must be provided as the seed value.

Remark concerning the JAX backend: When tracing functions with the JAX backend the global random_seed_generator() is not supported. Therefore, during tracing the default value seed=NULL will produce an error, and a seed argument must be provided.

Value

A tensor, a copy of x with the axis axis shuffled.