Commit Graph

3275 Commits

Author SHA1 Message Date
Diggory Hardy f5185d91fa thread_rng() → rand::rng() (#1506)
- Rename `rand::thread_rng()` → `rand::rng()`
- Remove `thread_rng()` and `random()` from the prelude
2024-10-11 08:51:21 +01:00
Artyom Pavlov 0fba9401c4 rand_core: add blanket impl of TryRngCore for RngCore (#1499)
This PR removes the hacky `impl_try_rng_from_rng_core` and
`impl_try_crypto_rng_from_crypto_rng` macros and replaces them with
blanket impls of `TryRngCore` for `RngCore` and `TryCryptoRng` for
`CryptoRng`.

This change means that `TryRngCore`/`TryCryptoRng` no longer can have
blanket impls for `&mut R` and `Box<R>`. But I think it should be
tolerable since most users will be using `RngCore`/`CryptoRng`, which
have blanket impl for `DerefMut` (it covers both `&mut R` and `Box<R>`).
2024-10-09 13:27:07 +03:00
Benjamin Lieser 9c2787de73 Cdf testing with Kolmogorov Smirnov (#1494) 2024-10-08 09:57:47 +01:00
Arthur Silva d1f961c4be Improve SmallRng initialization performance (#1482) 2024-10-07 12:12:40 +01:00
Joshua Liebow-Feeser d2eb51bc29 Remove some unsafe, update to zerocopy 0.8.0 (#1502) 2024-10-07 09:29:52 +01:00
Benjamin Lieser bc3341185e Make sure BTPE is not entered when np < 10 (#1484) 2024-10-03 20:18:56 +01:00
Diggory Hardy 66b11eb17b Rename gen_iter → random_iter, misc.. (#1500)
This extracts the non-inherent-methods stuff from #1492.
2024-10-01 14:59:11 +01:00
Benjamin Lieser e2092e9251 Poisson u64 sampling (#1498)
This addresses https://github.com/rust-random/rand/issues/1497 by adding
`Distribution<u64>`
It also solves https://github.com/rust-random/rand/issues/1312 by not
allowing `lambda` bigger than `1.844e19` (this also makes them always
fit into `u64`)
2024-10-01 14:27:39 +01:00
Diggory Hardy f2638201ff Poisson: split Knuth/Rejection methods (#1493) 2024-09-23 18:02:25 +01:00
Diggory Hardy ef052ec539 No usize except uniform (#1487)
- Add UniformUsize
- Support ..end and ..=ub range syntax for unsigned ints
2024-09-09 08:33:43 +01:00
Clar Fon 71c53be9a9 Require SeedableRng::Seed to impl Clone + AsRef (#1491) 2024-09-09 08:10:01 +01:00
Diggory Hardy 9e030aa221 Migrate remaining benchmarks to Criterion (#1490)
Translate everything still using the old test harness to Criterion.
2024-09-06 09:07:47 +01:00
Diggory Hardy 79f1b0ffdb Document known issues: #1378, #1312, #1476. 2024-08-12 12:16:08 +01:00
Diggory Hardy 2833c78417 Document Rng::fill, random differences 2024-07-28 10:48:07 +01:00
Bruce Mitchener f7bbccaedf Rename serde1 feature to serde. (#1477) 2024-07-26 08:48:53 +01:00
Diggory Hardy 2d5948d264 rand::distributions -> distr; split uniform module (#1470) 2024-07-23 14:14:11 +01:00
Diggory Hardy 605476c4e4 Portability fixes (#1469)
- Fix portability of `choose_multiple_array`
- Fix portability of `rand::distributions::Slice`
2024-07-23 13:50:31 +01:00
Bruce Mitchener f3aab23fba Fix clippy::doc_markdown warnings. (#1474) 2024-07-20 09:56:27 +01:00
Bruce Mitchener e4874a6dd7 Fix some typos. (#1472) 2024-07-20 09:42:52 +01:00
Diggory Hardy 1e381d13ee UniformFloat: allow inclusion of high in all cases (#1462)
Fix #1299 by removing logic specific to ensuring that we emulate a
closed range by excluding `high` from the result.
2024-07-16 11:32:06 +01:00
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
Diggory Hardy ca9e119859 Add IndexedRandom::choose_multiple_array, index::sample_array (#1453)
* New private module rand::seq::iterator
* New private module rand::seq::slice
* Add index::sample_array and IndexedRandom::choose_multiple_array
2024-06-04 09:32:57 +01:00
Artyom Pavlov ef75e56cf5 Fix Nightly Clippy lints (#1457) 2024-05-25 17:17:43 +03:00
Artyom Pavlov 6a4650691f Fix benches CI job (#1456) 2024-05-24 15:03:57 +01:00
Diggory Hardy ba7f5155d3 Revise RNG docs; enable small_rng by default (#1455) 2024-05-23 14:12:08 +01:00
Diggory Hardy defeb0cea3 Revise crate doc for rand_pcg, rand_chacha (#1454)
* Pub-reexport rand_core from rand_pcg
* Add getrandom feature to rand_pcg, rand_chacha
2024-05-23 07:21:07 +01:00
Artyom Pavlov 10a1fa4d22 Tweak docs CI job (#1451) 2024-05-11 13:42:15 +03: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
Joshua Liebow-Feeser 1f818787ca Use zerocopy 0.7.33, not 0.8.0-alpha (#1446) 2024-05-07 04:38:30 -07:00
Makro b10172f2cf Make fn WeightedTreeIndex::try_sample public 2024-05-07 11:25:40 +01:00
Joe Richey a2375dceaf Add #[track_caller] to methods which panic (#1442)
* Add #[track_caller] to methods which panic

This makes it easier to diagnose problems when the preconidtions of
these methods are not met.

Signed-off-by: Joe Richey <joerichey@google.com>
2024-05-05 08:19:29 +01:00
Vinzent Steinberg 4f8257a986 Rename Rng::gen to Rng::random (#1438) 2024-04-29 19:41:10 +01:00
Vinzent Steinberg 089d99368d Merge pull request #1439 from dhardy/upgrade-criterion
Upgrade criterion
2024-04-29 19:03:19 +02:00
Diggory Hardy bf0301bfe6 Fix test.yml 2024-04-27 09:25:00 +01:00
Diggory Hardy 6389320091 Update Cargo.lock.msrv again 2024-04-27 09:17:29 +01:00
Diggory Hardy 75a233b02a Add note to CHANGELOG 2024-04-27 09:06:46 +01:00
Diggory Hardy e55b1f6ee5 Merge rand_distr/benches into benches 2024-04-27 08:59:58 +01:00
Diggory Hardy 24b84a09a1 Move Criterion benches to benches/src 2024-04-27 08:46:09 +01:00
Diggory Hardy 3c0661b804 Rename rand_benches -> benches 2024-04-27 08:46:09 +01:00
Diggory Hardy 47d0b54f79 Remove pin on Rayon versions 2024-04-27 08:31:57 +01:00
Diggory Hardy f6ac90fc8d Updated Cargo.lock.msrv 2024-04-27 08:31:57 +01:00
Diggory Hardy 13620d9775 Test feature serde1 on rand_chacha 2024-04-27 08:22:51 +01:00
Vinzent Steinberg 0935356be9 Fix benches test in pipeline 2024-04-26 14:25:51 +02:00
Vinzent Steinberg 9855f37930 Pin rayon and rayon-core to support MSRV 1.61 2024-04-26 14:22:00 +02:00