Skip to contents

Sample Bernoulli random variables on mlx arrays

Usage

mlx_rand_bernoulli(dim, prob = 0.5, device = mlx_default_device())

Arguments

dim

Integer vector specifying the array shape/dimensions.

prob

Probability of a one.

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 boolean array.

Examples

mask <- mlx_rand_bernoulli(c(4, 4), prob = 0.3)