Skip to content

Commit

Permalink
Update correlated log-normal samples example
Browse files Browse the repository at this point in the history
Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>
  • Loading branch information
dhardy and vks committed Oct 9, 2020
1 parent 4ba6403 commit ce642d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rand_distr/src/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,15 @@ where F: Float, StandardNormal: Distribution<F>

/// Sample from a z-score
///
/// This may be useful for generating correlated samples, as follows.
/// This may be useful for generating correlated samples `x1` and `x2`
/// from two different distributions, as follows.
/// ```
/// # use rand::prelude::*;
/// # use rand_distr::{LogNormal, StandardNormal};
/// let mut rng = thread_rng();
/// let z = StandardNormal.sample(&mut rng);
/// let x1 = LogNormal::from_mean_cv(3.0, 1.0).unwrap().from_zscore(z);
/// let x2 = LogNormal::from_mean_cv(2.0, 1.0).unwrap().from_zscore(z);
/// let x2 = LogNormal::from_mean_cv(2.0, 4.0).unwrap().from_zscore(z);
/// ```
#[inline]
pub fn from_zscore(&self, zscore: F) -> F {
Expand Down

0 comments on commit ce642d4

Please sign in to comment.