Commit Graph

2612 Commits

Author SHA1 Message Date
Vinzent Steinberg 19fc4e8008 Implement IntoIterator for IndexVec
This fixes a clippy warning and slightly improves ergonomic.

This is technically a breaking change, but it is unlikely to break code
in practice, since `IntoIterator` is in Rust's prelude.
2020-07-31 20:48:04 +02:00
Vinzent Steinberg 28bf11d237 Fix some minor clippy warnings 2020-07-31 20:48:04 +02:00
Wout Schellaert cc2e7dd320 Handle NaN in WeightedIndex with error instead of panic 2020-07-31 18:20:44 +02:00
Diggory Hardy 39a37f0ddf Merge pull request #985 from jongiddy/reject-bench
Add a benchmark for 32-bit UniformInt sample_single
2020-07-19 08:20:18 +01:00
Jonathan Giddy c337164bbb Add a benchmark for UniformInt sample_single 2020-07-18 08:14:11 +01:00
Jonathan Giddy 1d54f1190f Move standard and uniform benchmarks to top-level crate 2020-07-08 07:45:01 +01:00
Raimundo Saona c9f485a015 Allow lambda zero for parametrization in Exp distribution. (#972)
* Allow lambda zero for parametrization in Exp distribution.

* Inaccurate — "or NaN"

Updated description of LambdaTooSmall error.

* Update CHANGELOG.md
2020-07-03 10:15:37 +01:00
Miguel Bartelsman fddcac1488 Update random() documentation (#994)
Solves #993.

Includes implementation details for easy peeking in IDEs
2020-07-03 09:30:15 +01:00
Sebastian Thiel 2c2fbd6463 Reduce packaged crate size by 5kb using cargo diet -r (#983)
* Reduce packaged crate size by 5kb using `cargo diet -r`

It converted excludes into includes, removing the following files
from the package.

┌───────────────────────────────────────────┬─────────────┐
│ File                                      │ Size (Byte) │
├───────────────────────────────────────────┼─────────────┤
│ .gitignore                                │          77 │
│ .github/ISSUE_TEMPLATE/other.md           │          80 │
│ .github/ISSUE_TEMPLATE/feature_request.md │         274 │
│ .github/ISSUE_TEMPLATE/compile-issue.md   │         488 │
│ utils/ci/install_cargo_web.sh             │         536 │
│ COPYRIGHT                                 │         569 │
│ utils/ci/miri.sh                          │         815 │
│ rustfmt.toml                              │         863 │
│ benches/weighted.rs                       │        1088 │
│ utils/ci/install.sh                       │        1381 │
│ utils/ci/script.sh                        │        1583 │
│ examples/monte-carlo.rs                   │        1611 │
│ appveyor.yml                              │        2098 │
│ SECURITY.md                               │        2822 │
│ .travis.yml                               │        2952 │
│ utils/ziggurat_tables.py                  │        3929 │
│ examples/monty-hall.rs                    │        4004 │
│ benches/misc.rs                           │        4524 │
│ benches/seq.rs                            │        5410 │
│ benches/generators.rs                     │        5490 │
└───────────────────────────────────────────┴─────────────┘

* Include COPIRIGHT in package

* Ignore benchmarks and tests in rand_distr

* prefer using 'src/' instead of 'src/**/*'
2020-05-31 16:18:05 +01:00
Kaz Wesley 4b99567b56 impl PartialEq, Eq for rngs (#979)
Implements #974. As in #975, but defining equality such that the user is
not exposed to the fact that one logical state may have different
representations in an implementation-specific way.
2020-05-29 09:40:09 +01:00
Kaz Wesley 22cc8fe4cd ChaCha: fix behavior on block count wrap (#980)
Documented behavior is to allow the counter to wrap around, but
implementation was panicking on that event in debug-mode builds.

Also fix `get_word_pos` handling of counter-wrapping, add some tests,
and make math easier to read.
2020-05-22 19:49:25 +01:00
CGMossa 7ede440385 Added serde1 feature to Serialize/Deserialize WeightedIndex (#974)
Re-enable serde1 for all distributions, StepRng and IndexVec
2020-05-18 09:24:26 +01:00
Youngsuk Kim 6a5f0d4fee Minor fixes to remove unnecessary 'cargo doc' warnings (#978) 2020-05-16 18:14:36 +01:00
Yannick Feld bf8b5a98ac rand_pcg README.md Remove unnecessary [ 2020-04-29 13:58:01 +02:00
Diggory Hardy a6ae9488c7 Travis: replace tarvis-cargo with pages upload 2020-04-11 08:53:53 +01:00
Diggory Hardy 4103a35f1c Merge pull request #963 from Shnatsel/safe_read_u64
Drop unsafe code from next_u64
2020-04-06 09:08:45 +01:00
Diggory Hardy 4a3a5cb446 Merge pull request #962 from Shnatsel/safe_seed_from_u64
Drop unsafe code from SeedableRng::seed_from_u64
2020-04-06 09:07:53 +01:00
Sergey "Shnatsel" Davidoff 5489851e73 Use .to_le_bytes() instead of .to_le().to_ne_bytes() 2020-04-05 14:50:55 +02:00
Diggory Hardy 05a1273ea8 Merge pull request #960 from Shnatsel/safer_rand_hc
Drop unsafe code from rand_hc, use asserts to optimize out bounds checks
2020-04-05 12:18:49 +01:00
Sergey "Shnatsel" Davidoff f9f59833e0 Drop unsafe code from next_u64 2020-04-04 15:17:15 +02:00
Sergey "Shnatsel" Davidoff 93ee2fdb41 Drop unsafe code from SeedableRng::seed_from_u64 2020-04-04 04:09:13 +02:00
Sergey "Shnatsel" Davidoff de9dfdd868 Drop unsafe code from rand_hc and instead use asserts to convince the compiler to optimize out bounds checks 2020-04-04 03:11:11 +02:00
Diggory Hardy 2962dea310 Merge pull request #956 from facorread/patch-1
Rounding error fix on WeightedIndex::update_weights()
2020-03-27 08:54:28 +00:00
Fabio A. Correa 4679f05673 Rounding error fix on WeightedIndex::update_weights()
WeightedIndex::update_weights() uses subtraction on old_w. Rounding errors, particularly on f32, may bring total_weight to below 0. This PR makes sure a negative total_weight results in an error.

This replaces PR #955 which was invalidated after a merge. Thanks for your consideration!
2020-03-26 16:50:29 -04:00
Diggory Hardy d0a584c4d5 Merge pull request #954 from elaye/feat/inverse-normal-inverse-gaussian-dists
Inverse / normal-inverse gaussian distributions
2020-03-26 20:15:10 +00:00
Vinzent Steinberg 8592ad3b4a Merge pull request #945 from dhardy/alias-method
Move Alias-method WeightedIndex to rand_distr
2020-03-26 16:25:25 +01:00
Elie Génard 7983840f72 Fix error variant name 2020-03-21 16:24:18 +01:00
Elie Génard 0205195e72 Improve exponentiation performance 2020-03-21 12:25:06 +01:00
Elie Génard 868eaa93d4 Fix error name 2020-03-21 12:21:18 +01:00
Elie Génard d841db0575 Add value stability tests 2020-03-21 10:36:21 +01:00
Elie Génard 3c9172975b Qualify imports 2020-03-21 10:36:07 +01:00
Elie Génard 162d0a24c3 Add normal-inverse Gaussian distribution 2020-03-20 12:24:44 +01:00
Elie Génard f8b587e4af Add inverse Gaussian distribution 2020-03-20 12:24:11 +01:00
Diggory Hardy 1a23bc8db8 Merge remote-tracking branch 'origin/master' into alias-method 2020-03-20 09:18:52 +00:00
Diggory Hardy 29689f55fc Deprecate use of rand::distributions::weighted module 2020-03-20 09:16:13 +00:00
Diggory Hardy 0c86451862 Merge pull request #948 from dhardy/work
Add std_rng feature, remove deprecations
2020-03-20 08:58:05 +00:00
Diggory Hardy 6a3d3a20b0 Fix alloc-no-std build 2020-03-10 12:18:35 +00:00
Diggory Hardy e96cc6fed5 Cargo.toml doc: address review 2020-03-10 12:14:36 +00:00
Diggory Hardy e2112c4404 Merge pull request #950 from coltfred/rand-chacha-0.2.2
Update changelog for rand-chacha 0.2.2
2020-03-10 10:47:26 +00:00
Colt Frederickson c67a857b16 Update changelog for rand-chacha 0.2.2 2020-03-09 13:40:54 -06:00
Diggory Hardy ca755824ac Remove deprecated EntropyRng 2020-03-09 15:28:11 +00:00
Diggory Hardy 3abd83a4f7 Remove deprecated distributions 2020-03-09 15:27:01 +00:00
Diggory Hardy abcd587bd8 Rand: add std_rng feature flag 2020-03-09 15:23:10 +00:00
Diggory Hardy 0aa461715b rand: remove wasm-bindgen and stdweb feature flags
These feature flags are re-exports from getrandom and were
already scheduled for removal in 0.8.
2020-03-09 14:35:52 +00:00
Diggory Hardy 8d225e4e14 rand: remove wasm_bindgen test
This test is now redundant with testing within the getrandom repository.
2020-03-09 14:34:34 +00:00
Diggory Hardy 8ed19df4fd Merge pull request #944 from coltfred/crypto-rng-chachacore
Add CryptoRng marker trait to ChaChaXCore
2020-03-09 14:17:43 +00:00
Diggory Hardy 967c22ee6d Fixes: remove cfg, adjust doc, fix imports 2020-03-09 13:29:39 +00:00
Diggory Hardy 2061960a99 Move rand::distributions::weighted module out of sub-dir 2020-03-09 13:11:23 +00:00
Diggory Hardy a76ab4155a Move alias method WeightedIndex to rand_distr 2020-03-09 13:10:40 +00:00
Diggory Hardy 108632c900 Merge pull request #940 from dhardy/work
Replace AsByteSliceMut with Fill
2020-03-09 11:13:25 +00:00