Skip to contents

Generate raw random bits on MLX arrays

Usage

mlx_key_bits(dim, width = 4L, key = NULL, device = mlx_default_device())

Arguments

dim

Integer vector specifying the array shape/dimensions.

width

Number of bytes per element (default 4 = 32 bits). Must be positive.

key

Optional mlx key array. If omitted, MLX's default generator is used.

device

Execution target: provide "gpu", "cpu", or an mlx_stream created via mlx_new_stream(). Defaults to the current mlx_default_device().

Value

An mlx array of unsigned integers filled with random bits.

Examples

k <- mlx_key(12)
raw_bits <- mlx_key_bits(c(4, 4), key = k)