mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 12:54:25 +02:00
Merge pull request #688 from jharwell/rng-distribution-fix
Fix {normal, extreme_value} distributions to work with quantities
This commit is contained in:
@@ -289,7 +289,7 @@ struct extreme_value_distribution : public std::extreme_value_distribution<typen
|
|||||||
template<typename Generator>
|
template<typename Generator>
|
||||||
Q operator()(Generator& g)
|
Q operator()(Generator& g)
|
||||||
{
|
{
|
||||||
return Q(base::operator()(g));
|
return base::operator()(g) * Q::reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Q a() const { return base::a() * Q::reference; }
|
[[nodiscard]] Q a() const { return base::a() * Q::reference; }
|
||||||
@@ -313,7 +313,7 @@ struct normal_distribution : public std::normal_distribution<typename Q::rep> {
|
|||||||
template<typename Generator>
|
template<typename Generator>
|
||||||
Q operator()(Generator& g)
|
Q operator()(Generator& g)
|
||||||
{
|
{
|
||||||
return Q(base::operator()(g));
|
return base::operator()(g) * Q::reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Q mean() const { return base::mean() * Q::reference; }
|
[[nodiscard]] Q mean() const { return base::mean() * Q::reference; }
|
||||||
|
Reference in New Issue
Block a user