Skip to content

Commit 2177a3d

Browse files
authored
README: what rand is / is not (#1065)
Also: add testing for simd_support on AppVeyor (fixes #1049)
1 parent a91c6af commit 2177a3d

File tree

2 files changed

+53
-29
lines changed

2 files changed

+53
-29
lines changed

README.md

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,41 @@
88
[![API](https://docs.rs/rand/badge.svg)](https://docs.rs/rand)
99
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.36+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
1010

11-
A Rust library for random number generation.
12-
13-
Rand provides utilities to generate random numbers, to convert them to useful
14-
types and distributions, and some randomness-related algorithms.
15-
16-
The core random number generation traits of Rand live in the [rand_core](
17-
https://crates.io/crates/rand_core) crate but are also exposed here; RNG
18-
implementations should prefer to use `rand_core` while most other users should
19-
depend on `rand`.
11+
A Rust library for random number generation, featuring:
12+
13+
- Easy random value generation and usage via the [`Rng`](https://docs.rs/rand/*/rand/trait.Rng.html),
14+
[`SliceRandom`](https://docs.rs/rand/*/rand/seq/trait.SliceRandom.html) and
15+
[`IteratorRandom`](https://docs.rs/rand/*/rand/seq/trait.IteratorRandom.html) traits
16+
- Secure seeding via the [`getrandom` crate](https://crates.io/crates/getrandom)
17+
and fast, convenient generation via [`thread_rng`](https://docs.rs/rand/*/rand/fn.thread_rng.html)
18+
- A modular design built over [`rand_core`](https://crates.io/crates/rand_core)
19+
([see the book](https://rust-random.github.io/book/crates.html))
20+
- Fast implementations of the best-in-class [cryptographic](https://rust-random.github.io/book/guide-rngs.html#cryptographically-secure-pseudo-random-number-generators-csprngs) and
21+
[non-cryptographic](https://rust-random.github.io/book/guide-rngs.html#basic-pseudo-random-number-generators-prngs) generators
22+
- A flexible [`distributions`](https://docs.rs/rand/*/rand/distributions/index.html) module
23+
- Samplers for a large number of random number distributions via our own
24+
[`rand_distr`](https://docs.rs/rand_distr) and via
25+
the [`statrs`](https://docs.rs/statrs/0.13.0/statrs/)
26+
- [Portably reproducible output](https://rust-random.github.io/book/portability.html)
27+
- `#[no_std]` compatibility (partial)
28+
- *Many* performance optimisations
29+
30+
It's also worth pointing out what `rand` *is not*:
31+
32+
- Small. Most low-level crates are small, but the higher-level `rand` and
33+
`rand_distr` each contain a lot of functionality.
34+
- Simple (implementation). We have a strong focus on correctness, speed and flexibility, but
35+
not simplicity. If you prefer a small-and-simple library, there are
36+
alternatives including [fastrand](https://crates.io/crates/fastrand)
37+
and [oorandom](https://crates.io/crates/oorandom).
38+
- Slow. We take performance seriously, with considerations also for set-up
39+
time of new distributions, commonly-used parameters, and parameters of the
40+
current sampler.
2041

2142
Documentation:
43+
2244
- [The Rust Rand Book](https://rust-random.github.io/book)
23-
- [API reference (master)](https://rust-random.github.io/rand)
45+
- [API reference (master branch)](https://rust-random.github.io/rand)
2446
- [API reference (docs.rs)](https://docs.rs/rand)
2547

2648

@@ -38,35 +60,36 @@ To get started using Rand, see [The Book](https://rust-random.github.io/book).
3860

3961
## Versions
4062

41-
Rand libs have inter-dependencies and make use of the
42-
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
43-
compatible across crate versions. (This is especially important for `RngCore`
44-
and `SeedableRng`.) A few crate releases are thus compatibility shims,
45-
depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and
46-
`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and
47-
`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can
48-
cause build errors. Usually, running `cargo update` is enough to fix any issues.
63+
Rand is *mature* (suitable for general usage, with infrequent breaking releases
64+
which minimise breakage) but not yet at 1.0. We maintain compatibility with
65+
pinned versions of the Rust compiler (see below).
4966

50-
The Rand lib is not yet stable, however we are careful to limit breaking changes
51-
and warn via deprecation wherever possible. Patch versions never introduce
52-
breaking changes. The following minor versions are supported:
67+
Current Rand versions are:
5368

5469
- Version 0.7 was released in June 2019, moving most non-uniform distributions
5570
to an external crate, moving `from_entropy` to `SeedableRng`, and many small
5671
changes and fixes.
57-
- Version 0.6 was released in November 2018, redesigning the `seq` module,
58-
moving most PRNGs to external crates, and many small changes.
59-
- Version 0.5 was released in May 2018, as a major reorganisation
60-
(introducing `RngCore` and `rand_core`, and deprecating `Rand` and the
61-
previous distribution traits).
62-
- Version 0.4 was released in December 2017, but contained almost no breaking
63-
changes from the 0.3 series.
72+
- The `master` branch is close to 0.8 release.
6473

65-
A detailed [changelog](CHANGELOG.md) is available.
74+
A detailed [changelog](CHANGELOG.md) is available for releases.
6675

6776
When upgrading to the next minor series (especially 0.4 → 0.5), we recommend
6877
reading the [Upgrade Guide](https://rust-random.github.io/book/update.html).
6978

79+
Rand has not yet reached 1.0 implying some breaking changes may arrive in the
80+
future ([SemVer](https://semver.org/) allows each 0.x.0 release to include
81+
breaking changes), but is considered *mature*: breaking changes are minimised
82+
and breaking releases are infrequent.
83+
84+
Rand libs have inter-dependencies and make use of the
85+
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
86+
compatible across crate versions. (This is especially important for `RngCore`
87+
and `SeedableRng`.) A few crate releases are thus compatibility shims,
88+
depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and
89+
`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and
90+
`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can
91+
cause build errors. Usually, running `cargo update` is enough to fix any issues.
92+
7093
### Yanked versions
7194

7295
Some versions of Rand crates have been yanked ("unreleased"). Where this occurs,

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ build: false
3434
test_script:
3535
- cargo test --tests --no-default-features
3636
- cargo test --tests --no-default-features --features=alloc,getrandom
37+
- cargo test --features simd_support
3738
# all stable features:
3839
- cargo test --features=serde1,log
3940
- cargo test --benches --features=nightly

0 commit comments

Comments
 (0)