23 Commits

Author SHA1 Message Date
Vinzent Steinberg
4f8257a986
Rename Rng::gen to Rng::random (#1438) 2024-04-29 19:41:10 +01:00
Diggory Hardy
4cbbb340ad
Remove automatic (delayed) reseed-on-fork (#1379)
* benches/generators.rs: standardize thread_rng benchmarks
* Remove cfgs from examples
* Remove ReadRng
* Add ThreadRng::reseed and doc to use
* Remove fork protection from ReseedingRng; remove libc dep
* Enable ReseedingRng without std
* Move ReseedingRng up; remove module rand::rngs::adapter
2024-03-18 17:41:15 +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
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
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
TheIronBorn
89d7e4e184
another typo 2022-07-09 03:26:38 +00:00
TheIronBorn
1f99bb72dc
assert deterministic 2022-07-08 19:36:21 +00:00
TheIronBorn
6112c84365
small deterministic example update 2022-07-07 18:58:36 +00:00
masonk
330efe9d42
Deterministic Rayon monte carlo example (#1236)
* 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>
2022-07-07 08:20:11 +01:00
Diggory Hardy
22dec87aac CI: more accurate no-default-feature and nightly test targets
Also more accurate flags in examples
2021-01-25 10:35:34 +00:00
Diggory Hardy
92e07018e0 rustfmt: expression spacing (on the line) 2020-01-02 15:46:14 +00:00
Diggory Hardy
61317ff0ef rustfmt: macro parameters and definition 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
Vinzent Steinberg
75d639b78d rand: Use Rust 2018 2019-06-12 17:02:36 +02:00
Diggory Hardy
b9e3e95fec Add rustfmt configuration and accept a few of its changes 2019-02-12 14:01:54 +00:00
Diggory Hardy
a50042d9d4 Follow up on #591: update authors and add new copyright where missed 2018-09-17 10:06:28 +01:00
Diggory Hardy
92aa49804b Remove references to COPYRIGHT file which are not needed
We have no sub-packages under different licences
2018-09-10 15:37:36 +01:00
Diggory Hardy
545895b84d Implement new choose_multiple functions 2018-06-15 13:32:44 +01:00
Vinzent Steinberg
8fcd8d123b Rename "range" to "uniform"
* `gen_range` was not changed.
* The types are still available under their deprecated, old names.

Fixes #393.
2018-04-17 19:18:09 +02:00
Paul Dicker
1fa5df6561 Parameterize range by X instead of RangeImpl 2018-03-30 12:02:00 +02:00
Diggory Hardy
d32be35517 Implement various Clippy suggestions
Many lints were disabled due to low or nil utility, and a few suggestions
ignored in the interests of readability or correctness. Command:

~/.cargo/bin/cargo-clippy --features=log,nightly,serde-1 -- -A inline_always -A approx_constant -A unreadable_literal -A cast_lossless -A len_zero -A unit_arg -A many_single_char_names -A doc_markdown -A single_match -A transmute_int_to_float -A float_cmp -A identity_op -A too_many_arguments -A new_ret_no_self
2018-03-27 15:22:14 +01:00
Diggory Hardy
3eeb319d52 Disable examples on no-std 2018-03-24 22:52:20 +00:00
Diggory Hardy
dc5f2e284b Extract examples from lib doc
Note: links are predictive. Unfortunately example code is not included in
generated documentation, so we must link to the repo.
2018-03-24 17:01:00 +00:00