mlx_rs::random

Function gumbel

Source
pub fn gumbel<'a, T: ArrayElement>(
    shape: impl IntoOption<&'a [i32]>,
    key: impl Into<Option<&'a Array>>,
) -> Result<Array>
Expand description

Sample from the standard Gumbel distribution.

The values are sampled from a standard Gumbel distribution which CDF exp(-exp(-x)).

let key = mlx_rs::random::key(0).unwrap();

// generate a single Float with Gumbel distribution
let value = mlx_rs::random::gumbel::<f32>(None, &key).unwrap().item::<f32>();

// generate an array of Float with Gumbel distribution in shape [10, 5]
let array = mlx_rs::random::gumbel::<f32>(&[10, 5], &key);