pub fn random_su2_close_to_unity<R>(
    spread_parameter: Real,
    rng: &mut R
) -> CMatrix2where
    R: Rng + ?Sized,
Expand description

Get a radom SU(2) matrix close the 1 or -1.

Note that it diverges from SU(2) slightly. spread_parameter should be between between 0 and 1 both excluded to generate valid data. outside this bound it will not panic but can have unexpected results.

Example

/// # Example

for _ in 0..10 {
    assert_matrix_is_su_2!(
        random_su2_close_to_unity(0.000_000_001_f64, &mut rng),
        0.000_000_1_f64
    );
}

but it will be not close to SU(2) up to f64::EPSILON.

assert_matrix_is_su_2!(
    random_su2_close_to_unity(0.000_000_001_f64, &mut rng),
    f64::EPSILON * 40_f64
);