335 Commits

Author SHA1 Message Date
Diggory Hardy
2584f48ace
Fix pert for mode approx eq mean; use builder pattern (#1452)
- Fix #1311 (mode close to mean)
- Use a builder pattern, allowing specification via mode OR mean
2024-07-16 09:04:49 +01:00
Diggory Hardy
d17ce4e0a1
rand_distr: split gamma module (#1464)
Move Beta, Student's t, Fisher-F, Chi-squared and Zeta distributions
to their own modules.
2024-07-11 14:50:22 +01:00
Michael Dyer
763dbc5bbb
rand_distr: Rename Zeta parameter from a to s (#1466) 2024-07-10 20:05:50 +01:00
Michael Dyer
17746a1ace
Add distribution plots to rand_distr documentation (#1434) 2024-07-08 20:16:19 +02:00
Artyom Pavlov
ef75e56cf5
Fix Nightly Clippy lints (#1457) 2024-05-25 17:17:43 +03:00
Diggory Hardy
ba7f5155d3
Revise RNG docs; enable small_rng by default (#1455) 2024-05-23 14:12:08 +01:00
Artyom Pavlov
890ad8b68b
Rename doc_cfg to docsrs and use doc_auto_cfg (#1450) 2024-05-10 13:46:26 +03:00
Artyom Pavlov
1b762b2867
Apply rustfmt and fix Clippy warnings (#1448) 2024-05-09 07:50:08 +01:00
Joe Richey
e93776960e
Update Panic documentation and #[track_caller] (#1447)
This is stuff I missed in #1442

Signed-off-by: Joe Richey <joerichey@google.com>
Co-authored-by: Diggory Hardy <git@dhardy.name>
2024-05-08 14:30:08 +01:00
Artyom Pavlov
fba5521f0f
Add TryRngCore and TryCryptoRng traits (#1424)
This reworks fallibility, replacing the fixed `Error` type.
2024-05-08 14:10:32 +01:00
Makro
b10172f2cf
Make fn WeightedTreeIndex::try_sample public 2024-05-07 11:25:40 +01:00
Diggory Hardy
e55b1f6ee5 Merge rand_distr/benches into benches 2024-04-27 08:59:58 +01:00
Diggory Hardy
eae3228c63
rand_distr/std_math: add note regarding other dependents (#1421) 2024-04-10 15:45:58 +01:00
Michael Dyer
bca078e929
Optimize imports (#1430) 2024-04-05 16:04:30 +01:00
dependabot[bot]
05189751b5
Update average requirement from 0.14 to 0.15 (#1426)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 15:45:29 +01:00
Diggory Hardy
0e626c7436
Cleaner README, remove MSRV shields (#1417) 2024-03-25 14:56:17 +00:00
Diggory Hardy
2eaf8545d4
Bump the MSRV to 1.61.0 (#1416) 2024-03-22 12:33:33 +00:00
Diggory Hardy
1015e709da
Prepare 0.9.0-alpha.1 (#1413) 2024-03-18 19:08:37 +00:00
dependabot[bot]
b45e892084
Update average requirement from 0.13 to 0.14 (#1388) 2024-03-18 09:28:20 +00:00
Diggory Hardy
5577003615
Update CHANGELOGs and prepare rand 0.9.0-alpha.0 (#1395)
Also: add pull-request template
2024-02-18 17:02:05 +00:00
dependabot[bot]
923bcf1711
Update serde_with requirement from 1.14.0 to 3.6.1 (#1392) 2024-02-18 10:20:46 +00:00
Diggory Hardy
dba696e9f1
Rename WeightedError → WeightError; add IndexedRandom, IndexedMutRandom (#1382)
* Remove deprecated module rand::distributions::weighted
* WeightedTree: return InvalidWeight on not-a-number
* WeightedTree::try_sample return AllWeightsZero given no weights
* Rename WeightedError -> WeightError and revise variants
* Re-export WeightError from rand::seq
* Revise errors of rand::index::sample_weighted
* Split SliceRandom into IndexedRandom, IndexedMutRandom and SliceRandom
2024-02-15 08:17:45 +00:00
dependabot[bot]
ef245fd582
Update special requirement from 0.8.1 to 0.10.3 (#1384) 2024-02-13 11:33:39 +00:00
Diggory Hardy
e5a366d07f
Update zerocopy; trim unused methods (#1393)
* Remove mention of stdsimd
* Move fns FloatSIMDUtils::replace, extract to new cfg-gated trait FloatSIMDScalarUtils
* Remove unused utility methods on floats, bool
* Remove unused import
* Update to zerocopy 0.8.0-alpha.5
* Remove unneeded import of Float
2024-02-13 11:13:57 +00:00
Makro
f827c006b5
Add WeightedIndexTree to dist_randr (#1372)
Add WeightedIndexTree to rand_distr

Co-authored-by: xmakro <makro@>
2024-02-08 15:00:58 +00:00
Vinzent Steinberg
c427cff1d5 Fix clippy warnings 2023-12-14 08:50:57 +01:00
Alex Saveau
ef89cbefaf
Support using std without getrandom or rand_chacha (#1354)
Support using std without getrandom or rand_chacha

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-11-06 08:15:07 +00:00
OldEnglishSheepdog
d0499f0a26
Correcting method name in comment (#1350)
Co-authored-by: Detlef <none@none.org>
2023-10-30 09:39:38 +00:00
bjorn3
e42c385872
MSRV=1.60, use more permissive cfg on test
* Use cfg(panic = unwind) instead of a check for wasm32 to see if unwinding is supported

This allows the test to run on a future wasm target with exception support as
well as running the test suite with panic=abort on non-wasm targets.

* Bump MSRV to 1.60
2023-10-11 08:54:54 +01:00
Guillaume Gomez
176e73647a
Add --generate-link-to-definition option when building on docs.rs (#1327)
* Add `--generate-link-to-definition` option when building on docs.rs

* Fix documentation issues
2023-07-29 08:12:57 +01:00
benjamin
a4739d8bd4 Add test for infinite loop 2023-07-05 08:58:12 +02:00
benjamin
c5af1f8072 Fix spaces 2023-07-05 08:56:46 +02:00
Benjamin Lieser
dc8bc097e3
Update rand_distr/src/binomial.rs
Some formatting

Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>
2023-07-04 23:04:40 +02:00
Benjamin Lieser
c7c65979a8 Fix infinite loop in Binomial distribution 2023-07-04 17:42:15 +02:00
Warren Weckesser
b593db692d
Replace tab character with spaces in poisson.rs. (#1320) 2023-06-20 15:50:19 +01:00
warren
c12db0b8ee Use an array for DirichletFromGamma.samplers 2023-03-30 15:35:22 -04:00
warren
22256529a4 Copy-edit a comment and make it a doc comment. 2023-03-25 10:06:58 -04:00
warren
7fcb25f11e Merge branch 'master' into dirichlet-small-alpha 2023-03-25 10:00:20 -04:00
warren
7c97f9b86d Merge master and fix conflicts.
The main change is that Dirichlet now has a const trait N for
the dimension.  The other significant change is to propagate
errors that could occur when Beta:new or Gamma::new is called.
2023-03-25 09:49:08 -04:00
Virgile Andreani
0f5af6672d
Use const generics in Dirichlet (#1292)
* Use const generics in Dirichlet

* Serialize const arrays with serde_with
2023-03-18 09:21:59 +00:00
warren
030d2ad4f4 Fix namespace qualifier for Serialize and Deserialize. 2023-02-28 20:54:28 -05:00
warren
7513e838b7 Convert Dirichlet from an enum to a struct containing an enum. 2023-02-28 20:01:42 -05:00
warren
4ecb35eaf0 Refactor:
* Create a struct for each random variate generation method:
  DirichletFromGamma and DirichletFromBeta.
* Move the initialization of the data required by the generators
  into the new() method.
* Make the main Dirichlet object an enum.
2023-02-28 16:12:12 -05:00
warren
c44ac16e40 Merge branch 'master' into dirichlet-small-alpha 2023-02-27 19:22:54 -05:00
Thomas Dupic
0f3ecedef0
Poisson distribution falls into an infinite loop for parameter λ=∞ (#1290) (#1291) 2023-02-27 08:08:13 +00:00
Oliver Tearne
f2e21db971
Poisson returns -1 for small lambda (#1284)
* Correct Knuth's method since not using do-while
2023-02-13 09:08:01 +00:00
Vinzent Steinberg
7d73990096
Make Uniform constructors return a result (#1229)
* Forbid unsafe code in crates without unsafe code

This helps tools like `cargo geiger`.

* Make `Uniform` constructors return a result

- This is a breaking change.
- The new error type had to be made public, otherwise `Uniform` could
  not be extended for user-defined types by implementing
  `UniformSampler`.
- `rand_distr` was updated accordingly.
- Also forbid unsafe code for crates where none is used.

Fixes #1195, #1211.

* Address review feedback
* Make `sample_single` return a `Result`
* Fix benchmarks
* Small fixes
* Update src/distributions/uniform.rs
2023-02-06 10:55:22 +00:00
Diggory Hardy
19169cbce9
Bump MSRV to 1.56 (Edition 2021) (#1269)
* Bump MSRV to 1.56 (Edition 2021)

* Apply Clippy suggestions

* Bump edition and add rust-version field to Cargo.toml

* CI AVR test: unpin nightly rust version

* Disable AVR test

* Bump crate version numbers for a breaking release
2022-12-06 19:01:10 +00:00
ironhaven
0aca9028f2
SmallRng uses wrong seed_from_u64 implementation (#1203)
* Forward inner seed_from_u64 implmentation for SmallRng

* increase tolerance of sparkline tests
2022-11-14 12:08:30 +00:00
Diggory Hardy
9720f110a6
Update GitHub Actions (#1263)
* examples/rayon-monte-carlo.rs: remove execute bit of file metadata

* Document in README that MSRV is 1.51.0

This was changed in #1246

* Update GitHub Actions
2022-11-10 15:36:40 +00:00