Sample Bernoulli random variables on mlx arrays
Usage
mlx_rand_bernoulli(dim, prob = 0.5, device = mlx_default_device())Arguments
- dim
Integer vector specifying array dimensions (shape).
- prob
Probability of a one.
- device
Execution target: supply
"gpu","cpu", or anmlx_streamcreated viamlx_new_stream(). Defaults to the currentmlx_default_device()unless noted otherwise (helpers that act on an existing array typically reuse that array's device or stream).
Examples
mask <- mlx_rand_bernoulli(c(4, 4), prob = 0.3)