pub fn uniform<'a>(
low: f64,
high: f64,
shape: impl IntoShape,
dtype: DType,
key: impl Into<Option<&'a Array>>,
) -> ArrayExpand description
Uniform samples in [low, high) of shape and floating-point dtype (float16,
bfloat16 or float32), as MLX: 32 random bits divided by u32::MAX, clamped below 1.
use nuvec_core::{DType, random};
let u = random::uniform(0.0, 1.0, [2, 3], DType::F32, Some(&random::key(1)));
assert_eq!(u.shape(), [2, 3]);
assert!(u.to_vec::<f32>().unwrap().iter().all(|&x| (0.0..1.0).contains(&x)));