Skip to content

Commit

Permalink
Dirst to dist
Browse files Browse the repository at this point in the history
Better naming convention
  • Loading branch information
bertini97 authored Oct 5, 2024
1 parent 41f48ae commit 2e4402b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/non_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! - linspace_with_precision
//! - rand
//! - rand_with_rng
//! - rand_with_distr
//! - rand_with_dist
//!
//! # Numpy like non-macro functions
//!
Expand Down Expand Up @@ -330,16 +330,16 @@ pub fn rand(r: usize, c: usize) -> Matrix {
/// Range = from 0 to 1
pub fn rand_with_rng<R: Rng>(r: usize, c: usize, rng: &mut R) -> Matrix {
let uniform = Uniform::new_inclusive(0f64, 1f64);
rand_with_distr(r, c, rng, uniform)
rand_with_dist(r, c, rng, uniform)
}

/// Rand matrix with specific rng and distribution
///
/// # Description
///
/// Any range
pub fn rand_with_distr<T: Into<f64>, R: Rng, D: Distribution<T>>(r: usize, c: usize, rng: &mut R, distr: D) -> Matrix {
matrix(rng.sample_iter(distr).take(r*c).collect(), r, c, Row)
pub fn rand_with_dist<T: Into<f64>, R: Rng, D: Distribution<T>>(r: usize, c: usize, rng: &mut R, dist: D) -> Matrix {
matrix(rng.sample_iter(dist).take(r*c).collect(), r, c, Row)
}

// ┌─────────────────────────────────────────────────────────┐
Expand Down

0 comments on commit 2e4402b

Please sign in to comment.