summaryrefslogtreecommitdiff
path: root/numpy/random/src
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/src')
-rw-r--r--numpy/random/src/distributions/distributions.c4
-rw-r--r--numpy/random/src/legacy/legacy-distributions.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/numpy/random/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c
index 6b4deb925..9bdfa9bea 100644
--- a/numpy/random/src/distributions/distributions.c
+++ b/numpy/random/src/distributions/distributions.c
@@ -508,7 +508,7 @@ double random_lognormal(bitgen_t *bitgen_state, double mean, double sigma) {
}
double random_rayleigh(bitgen_t *bitgen_state, double mode) {
- return mode * sqrt(-2.0 * npy_log1p(-next_double(bitgen_state)));
+ return mode * sqrt(2.0 * random_standard_exponential(bitgen_state));
}
double random_standard_t(bitgen_t *bitgen_state, double df) {
@@ -960,7 +960,7 @@ RAND_INT_TYPE random_geometric_search(bitgen_t *bitgen_state, double p) {
}
int64_t random_geometric_inversion(bitgen_t *bitgen_state, double p) {
- return (int64_t)ceil(npy_log1p(-next_double(bitgen_state)) / npy_log1p(-p));
+ return (int64_t)ceil(-random_standard_exponential(bitgen_state) / npy_log1p(-p));
}
int64_t random_geometric(bitgen_t *bitgen_state, double p) {
diff --git a/numpy/random/src/legacy/legacy-distributions.c b/numpy/random/src/legacy/legacy-distributions.c
index bfea15e40..443c1a4bf 100644
--- a/numpy/random/src/legacy/legacy-distributions.c
+++ b/numpy/random/src/legacy/legacy-distributions.c
@@ -112,6 +112,10 @@ double legacy_chisquare(aug_bitgen_t *aug_state, double df) {
return 2.0 * legacy_standard_gamma(aug_state, df / 2.0);
}
+double legacy_rayleigh(bitgen_t *bitgen_state, double mode) {
+ return mode * sqrt(-2.0 * npy_log1p(-next_double(bitgen_state)));
+}
+
double legacy_noncentral_chisquare(aug_bitgen_t *aug_state, double df,
double nonc) {
double out;