8
8
[ ![ API] ( https://docs.rs/rand/badge.svg )] ( https://docs.rs/rand )
9
9
[ ![ Minimum rustc version] ( https://img.shields.io/badge/rustc-1.36+-lightgray.svg )] ( https://github.com/rust-random/rand#rust-version-requirements )
10
10
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.
20
41
21
42
Documentation:
43
+
22
44
- [ 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 )
24
46
- [ API reference (docs.rs)] ( https://docs.rs/rand )
25
47
26
48
@@ -38,35 +60,36 @@ To get started using Rand, see [The Book](https://rust-random.github.io/book).
38
60
39
61
## Versions
40
62
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).
49
66
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:
53
68
54
69
- Version 0.7 was released in June 2019, moving most non-uniform distributions
55
70
to an external crate, moving ` from_entropy ` to ` SeedableRng ` , and many small
56
71
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.
64
73
65
- A detailed [ changelog] ( CHANGELOG.md ) is available.
74
+ A detailed [ changelog] ( CHANGELOG.md ) is available for releases .
66
75
67
76
When upgrading to the next minor series (especially 0.4 → 0.5), we recommend
68
77
reading the [ Upgrade Guide] ( https://rust-random.github.io/book/update.html ) .
69
78
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
+
70
93
### Yanked versions
71
94
72
95
Some versions of Rand crates have been yanked ("unreleased"). Where this occurs,
0 commit comments