142 Commits

Author SHA1 Message Date
Mark Wainwright
4bde8a0adb
Performance improvements for shuffle and partial_shuffle (#1272)
* Made shuffle and partial_shuffle faster
* Use criterion benchmarks for shuffle
* Added a note about RNG word size
* Tidied comments
* Added a debug_assert
* Added a comment re possible further optimization
* Added and updated copyright notices
* Revert cfg mistake
* Reverted change to mod.rs
* Removed ChaCha20 benches from shuffle
* moved debug_assert out of a const fn
2023-01-08 16:14:26 +00:00
Mark Wainwright
1e96eb4593
Added new versions of choose and choose_stable (#1268)
* Added new versions of choose and choose_stable

* Removed coin_flipper tests which were unnecessary and not building on ci

* Performance optimizations in coin_flipper

* Clippy fixes and more documentation

* Added a correctness fix for coin_flipper

* Update benches/seq.rs

Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>

* Update benches/seq.rs

Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>

* Removed old version of choose and choose stable and updated value stability tests

* Moved sequence choose benchmarks to their own file

* Reworked coin_flipper

* Use criterion for seq_choose benches

* Removed an old comment

* Change how c is estimated in coin_flipper

* Revert "Use criterion for seq_choose benches"

This reverts commit 23395391370ab95694558be90686eb16494e590a.

* Added seq_choose benches for smaller numbers

* Removed some unneeded lines from seq_choose

* Improvements in coin_flipper.rs

* Small refactor of coin_flipper

* Tidied comments in coin_flipper

* Use criterion for seq_choose benchmarks

* Made choose not generate a random number if len=1

* small change to IteratorRandom::choose

* Made it easier to change seq_choose benchmarks RNG

* Added Pcg64 benchmarks for seq_choose

* Added TODO to coin_flipper

* Changed criterion settings in seq_choose

Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com>
2023-01-05 10:49:33 +00:00
Adam Reichold
f44ea42089 Extend generator benchmarks to include the newly added Pcg64Dxsm variant. 2021-12-06 13:41:05 +01:00
Brandon H. Gomes
1544c728cd
fix no_std/alloc/std compatibility issues
- using min_const_gen on no_std fails to compile because of a bad import
- sample_efraimidis_spirakis only requires alloc but it was marked with
  a std requirement
2021-09-04 18:33:39 -04:00
Vinzent Steinberg
067238f057
Remove rand_hc (#1156)
* Remove `rand_hc`

We no longer need it for `rand`, so it can be moved to the `rngs`
repository.
2021-08-05 14:59:07 +02:00
Vinzent Steinberg
1b8eaf23ea rand: Fix clippy warnings 2021-05-08 21:37:15 -03:00
Zachary Neely
9b4df3bb0b Add choose_multiple_weighted, tests, and benchmarks 2020-08-27 18:21:07 +02:00
Vinzent Steinberg
bbb0dff53c Fix benchmarks 2020-08-05 13:25:25 +02:00
Vinzent Steinberg
98b915feed Change gen_range to accept Range types
This adds support for `Rng::range(a..b)` and `Rng::range(a..=b)`,
replacing `Rng::range(a, b)`. `a` and `b` must now implement
`PartialEq`.

This is a breaking change. In most cases, replacing
`Rng::gen_range(a, b)` with `Rng::gen_range(a..b)` should be enough,
however type annotations may be necessary, and `a` and `b` can no longer
be references or SIMD types.

SIMD types are still supported by `UniformSampler::sample_single`.

Some clippy warnings were fixed as well.
2020-08-01 16:09:50 +02: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
Diggory Hardy
571c9af9a6 Misc bench: add gen_1kb_u16_* 2020-02-28 15:34:08 +00:00
Diggory Hardy
92e07018e0 rustfmt: expression spacing (on the line) 2020-01-02 15:46:14 +00:00
Diggory Hardy
0f9500b725 rustfmt: function parameters 2020-01-02 15:46:14 +00:00
Diggory Hardy
1b3bcce9be rustfmt: closures 2020-01-02 15:46:14 +00:00
Diggory Hardy
363571540f rustfmt: method chaining 2020-01-02 15:46:14 +00:00
Diggory Hardy
4f1f0fce67 rustfmt: struct literals, if/for blocks 2020-01-02 15:46:14 +00:00
Diggory Hardy
477b47058f rustfmt: spacing, new-lines, trailing commas/semicolon 2020-01-02 15:46:14 +00:00
Diggory Hardy
ccb64dc0a0 rustfmt: attributes 2020-01-02 15:46:14 +00:00
Diggory Hardy
88aa915c66 rustfmt: use, mod statements and initial attributes 2020-01-02 15:46:14 +00:00
Diggory Hardy
2fc64ed429 Remove old RNG crates from benchmarks
Note: the init benches now use a different master RNG;
this appears to have little affect on results.
2019-09-20 16:47:46 +01:00
Vinzent Steinberg
ee6f33453e WeightedIndex: Clean up benchmark 2019-08-15 18:24:00 +02:00
Vinzent Steinberg
7351358e5a Benchmark creation vs. modification of WeightedIndex 2019-08-14 15:57:14 +02:00
Diggory Hardy
2dca83d861 Add inlining for StepRng 2019-06-27 10:01:12 +01:00
Vinzent Steinberg
8521f85b31 Fix benchmarks 2019-06-21 17:58:05 +02:00
Vinzent Steinberg
75d639b78d rand: Use Rust 2018 2019-06-12 17:02:36 +02:00
Diggory Hardy
18d55845ea rand_pcg: add Pcg64 RNG
Note: benchmarks now show different results to mentioned
for fill_bytes impl, possibly because of #[inline] changes
2019-06-11 13:29:21 +01:00
Diggory Hardy
01b1bf8958 Move distributions benchmark to rand_distr
This avoids a circular dependency between rand and rand_distr
2019-06-11 10:42:41 +01:00
Diggory Hardy
076fd1208e Benchmarks: enable usage without feature flags 2019-06-11 10:32:42 +01:00
Diggory Hardy
33bd4040f6 Replace StdRng algorithm with ChaCha20 and adjust reseeding threshold 2019-06-03 15:39:21 +01:00
Diggory Hardy
25896a7533 Add benchmarks for uniform usize samples
The usize64 bench is noticably slower than the others,
perhaps due to use of rejection sampling.
2019-06-03 14:25:37 +01:00
Vinzent Steinberg
c6bce2cec3 Make Bernoulli::new return a Result
Fixes #799.
2019-05-22 17:36:23 +02:00
Vinzent Steinberg
ec2f006d3c Fix benchmarks 2019-05-16 13:55:51 +02:00
Diggory Hardy
29da6f9061 Add benchmarks for new chacha variants 2019-04-30 21:14:42 +01:00
Diggory Hardy
1f7af60419
Merge pull request #782 from dhardy/distr
Add PERT distribution
2019-04-23 15:14:01 +01:00
Diggory Hardy
f8a7b42dd4 rand_distr::Triangular: tweaks, bench and tests 2019-04-22 17:49:31 +01:00
Diggory Hardy
232c634c61 Benches: fix warnings and move Binomial benches to appropriate suite 2019-04-22 11:43:48 +01:00
Diggory Hardy
6dc6c4932b
Merge pull request #770 from vks/distr-result
rand_distr: Use `Result` instead of panics
2019-04-20 09:23:43 +01:00
Vinzent Steinberg
10474c9c4d Fix benchmarks 2019-04-15 15:24:10 +02:00
Vinzent Steinberg
a2754c78c8 Fix distribution benchmarks 2019-04-09 15:31:29 +02:00
Diggory Hardy
b231ac20cc Remove dependence on rand_jitter
This is a breaking change for anyone using rngs::JitterRng;
such users should switch to rand_jitter::JitterRng.
2019-04-03 15:23:17 +01:00
Diggory Hardy
8cfe2101c5 Simplify and deprecate EntropyRng 2019-04-03 15:23:17 +01:00
Diggory Hardy
57ec955dcc Fix benchmark test 2019-03-29 07:46:05 +00:00
Diggory Hardy
aabc59671e
Merge pull request #692 from zroug/master
Add an implementation of alias method for weighted indices
2019-03-27 08:59:14 +00:00
zroug
5b2934122f Reorganized distributions::weighted module 2019-03-06 17:49:50 +01:00
Vinzent Steinberg
6323d2951e Binomial: Add benchmark for small n * p
Our previous implementation was very slow (#734). The benchmarks makes
sure we won't have such regressions in the future.
2019-02-26 18:11:28 +01:00
zroug
f392fb7708 Made AliasMethodWeightedIndex generic 2019-02-23 13:25:30 +01:00
zroug
1feb633179 Added tests for AliasMethodWeightedIndex 2019-02-23 13:25:30 +01:00
Diggory Hardy
23f0a5139b Implement Standard support for NonZero* types (Rustc ≥ 1.28) 2019-02-15 10:45:51 +00:00
Diggory Hardy
5a67e325ae
Merge pull request #642 from vks/xoshiro
Import xoshiro crate
2018-12-21 10:29:13 +00:00