ivy-random 0.10.3

Provides random utility functions to the ivy framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
use rand::prelude::*;

// Generates a random scalar between 0 and 1
pub fn normalized<R: Rng>(rng: &mut R) -> f32 {
    rng.gen_range(0.0..=1.0)
}

// Generates a random scalar between -1 and 1
pub fn one<R: Rng>(rng: &mut R) -> f32 {
    rng.gen_range(-1.0..=1.0)
}