* 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.
* 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
* 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
* 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>
The previous implementation used either `Vec::insert` or a second
F-Y shuffling phase to achieve fair random order. Instead, use the
random numbers already drawn to achieve a fair shuffle.
* 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
* 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
* Fix the documentation for `choose_weighted(_mut)` as discussed in #1243.
* Mention that elements of zero weight are handled as expected by `WeightedIndex` as discussed in #1243.
Additionally fix some minor issues.
* Let the second example of `WeightedIndex` use floats to stress that they are handled correctly for the zero case.
* Manually indent doc comments.
* Deterministic Rayon monte carlo
* Update deterministic mt with a batching example
* discuss determinism in the context of rayon + rand
* reword the discussion
Co-authored-by: Mason Kramer <mason@masonkramer.net>