Skip to content

Commit 8f37250

Browse files
authored
Merge pull request #1208 from newpavlov/rand_distr/fix_no_std
rand_distr: fix no_std build
2 parents 19404d6 + 9ef737b commit 8f37250

File tree

6 files changed

+12
-2
lines changed

6 files changed

+12
-2
lines changed

rand_distr/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.4.3] - 2021-12-30
8+
- Fix `no_std` build (#1208)
9+
710
## [0.4.2] - 2021-09-18
811
- New `Zeta` and `Zipf` distributions (#1136)
912
- New `SkewNormal` distribution (#1149)

rand_distr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_distr"
3-
version = "0.4.2"
3+
version = "0.4.3"
44
authors = ["The Rand Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"

rand_distr/src/binomial.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use crate::{Distribution, Uniform};
1313
use rand::Rng;
1414
use core::fmt;
1515
use core::cmp::Ordering;
16+
#[allow(unused_imports)]
17+
use num_traits::Float;
1618

1719
/// The binomial distribution `Binomial(n, p)`.
1820
///

rand_distr/src/geometric.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
use crate::Distribution;
44
use rand::Rng;
55
use core::fmt;
6+
#[allow(unused_imports)]
7+
use num_traits::Float;
68

79
/// The geometric distribution `Geometric(p)` bounded to `[0, u64::MAX]`.
810
///

rand_distr/src/hypergeometric.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use crate::Distribution;
44
use rand::Rng;
55
use rand::distributions::uniform::Uniform;
66
use core::fmt;
7+
#[allow(unused_imports)]
8+
use num_traits::Float;
79

810
#[derive(Clone, Copy, Debug)]
911
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]

rand_distr/src/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use crate::ziggurat_tables;
1212
use rand::distributions::hidden_export::IntoFloat;
1313
use rand::Rng;
14+
use num_traits::Float;
1415

1516
/// Calculates ln(gamma(x)) (natural logarithm of the gamma
1617
/// function) using the Lanczos approximation.
@@ -25,7 +26,7 @@ use rand::Rng;
2526
/// `Ag(z)` is an infinite series with coefficients that can be calculated
2627
/// ahead of time - we use just the first 6 terms, which is good enough
2728
/// for most purposes.
28-
pub(crate) fn log_gamma<F: num_traits::Float>(x: F) -> F {
29+
pub(crate) fn log_gamma<F: Float>(x: F) -> F {
2930
// precalculated 6 coefficients for the first 6 terms of the series
3031
let coefficients: [F; 6] = [
3132
F::from(76.18009172947146).unwrap(),

0 commit comments

Comments
 (0)