Skip to content

Commit 2dd1f18

Browse files
authored
Merge pull request #81 from rust-random/push-kyrypuxtmnlu
Fix guide links; guide tweaks
2 parents 1491694 + 0e0f5e6 commit 2dd1f18

File tree

10 files changed

+41
-26
lines changed

10 files changed

+41
-26
lines changed

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
14-
- name: Setup mdBook
15-
uses: peaceiris/actions-mdbook@v2
13+
- uses: jontze/action-mdbook@6c0be56d14c4bf16861b00af61f50ff7400ce502 # v4
1614
with:
17-
mdbook-version: '0.4.4'
18-
# mdbook-version: 'latest'
19-
15+
token: ${{secrets.GITHUB_TOKEN}}
16+
use-linkcheck: true
2017
- run: mdbook build
2118

2219
- name: Deploy

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ on:
77
branches: [ master, '0.[0-9]+' ]
88

99
jobs:
10+
build:
11+
name: Test building of docs
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: jontze/action-mdbook@6c0be56d14c4bf16861b00af61f50ff7400ce502 # v4
16+
with:
17+
token: ${{secrets.GITHUB_TOKEN}}
18+
use-linkcheck: true
19+
- run: mdbook build
20+
1021
code-samples:
1122
name: Test code samples
1223
runs-on: ubuntu-latest

book.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ description = "Extended documentation for Rust's Rand lib"
77

88
[output.html.playgen]
99
editable = true
10+
11+
[output.linkcheck]
12+
# NOTE: this requires https://github.com/Michael-F-Bryan/mdbook-linkcheck

src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- [Random processess](guide-process.md)
2222
- [Sequences](guide-seq.md)
2323
- [Error handling](guide-err.md)
24-
- [Testing functions that use RNGs](guide-test-fn-rng.md)
24+
- [Testing randomized functions](guide-test-fn-rng.md)
2525

2626
- [Updating](update.md)
2727
- [Updating to 0.5](update-0.5.md)

src/crate-features.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
# Crate features
22

3-
For definitive documentation of crate features, check the crate release's `Cargo.toml`:
3+
It is recommended to check the crate's `Cargo.toml` or `README.md` for features.
4+
Since `rand v0.9`, `rust-random` crates only use explicit features (i.e. all
5+
features are listed under `[features]`).
6+
7+
Release versions of `Cargo.toml` can be viewed on `docs.rs`:
48

59
- <https://docs.rs/crate/rand/latest/source/Cargo.toml.orig>
610
- <https://docs.rs/crate/rand_core/latest/source/Cargo.toml.orig>
711
- <https://docs.rs/crate/rand_distr/latest/source/Cargo.toml.orig>
12+
- <https://docs.rs/crate/rand_chacha/latest/source/Cargo.toml.orig>
13+
- <https://docs.rs/crate/rand_xoshiro/latest/source/Cargo.toml.orig>
14+
- <https://docs.rs/crate/rand_pcg/latest/source/Cargo.toml.orig>
815

916
## Common features
1017

1118
The following features are common to `rand_core`, `rand`, `rand_distr` and potentially some RNG crates:
1219

1320
- `std`: opt into functionality dependent on the `std` lib. This is default-enabled except in `rand_core`; for `no_std` usage, use `default-features = false`.
1421
- `alloc`: enables functionality requiring an allocator (for usage with `no_std`). This is implied by `std`.
15-
- `serde1`: enables serialization via [`serde`], version 1.0.
16-
17-
## Rand features
18-
19-
Additional `rand` features:
20-
21-
- `small_rng` enables the [`SmallRng`] generator (feature-gated since v0.7).
22-
- `simd_support`: Experimental support for generating various SIMD types (requires nightly `rustc`).
23-
- `log` enables a few log messages via [`log`].
24-
25-
Note regarding SIMD: the above flag concerns explicit generation of SIMD types
26-
only and not optimisation. SIMD operations may be used internally regardless of
27-
this flag; e.g. the ChaCha generator has explicit support for SIMD operations
28-
internally.
22+
- `serde`: enables serialization via [`serde`], version 1.0.
2923

3024
## rand_distr features
3125

@@ -36,3 +30,4 @@ performance but may produce different random values, the `std_math` feature
3630
can be enabled. (Note that any other crate depending on `num-traits`'s `std` feature (default-enabled) will have the same effect.)
3731

3832
[`SmallRng`]: https://docs.rs/rand/latest/rand/rngs/struct.SmallRng.html
33+
[`serde`]: https://serde.rs/

src/guide-rngs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
There are many kinds of RNGs, with different trade-offs. Rand provides some
44
convenient generators in the [`rngs` module]. Often you can just use
5-
[`thread_rng`], a function which automatically initializes an RNG in
5+
[`rand::rng`], a function which automatically initializes an RNG in
66
thread-local memory and returns a reference to it. It is fast, good quality,
77
and (to the best of our knowledge) cryptographically secure.
88

@@ -304,7 +304,7 @@ by P. Hellekalek.
304304
[`SmallRng`]: https://docs.rs/rand/latest/rand/rngs/struct.SmallRng.html
305305
[`StdRng`]: https://docs.rs/rand/latest/rand/rngs/struct.StdRng.html
306306
[`StepRng`]: https://docs.rs/rand/latest/rand/rngs/mock/struct.StepRng.html
307-
[`rng()`]: https://docs.rs/rand/latest/rand/fn.rng.html
307+
[`rand::rng`]: https://docs.rs/rand/latest/rand/fn.rng.html
308308
[basic PRNGs]: #basic-pseudo-random-number-generators-prngs
309309
[CSPRNGs]: #cryptographically-secure-pseudo-random-number-generators-csprngs
310310
[`Pcg32`]: https://docs.rs/rand_pcg/latest/rand_pcg/type.Pcg32.html

src/guide-seeding.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ key, usually specified as a byte-sequence for cryptographic generators or,
88
for small PRNGs, often just a word. We formalise this for all our generators
99
with the [`SeedableRng`] trait.
1010

11+
Note: seeding does not imply reproducibility of results. For that you need to
12+
use a named RNG with a fixed algorithm (e.g. `ChaCha12Rng` not `StdRng`). See
13+
also [Reproducibility](https://rust-random.github.io/book/crate-reprod.html).
14+
1115
## The Seed type
1216

1317
We require all seedable RNGs to define a [`Seed`] type satisfying

src/guide-test-fn-rng.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Testing functions that use RNGs
1+
# Testing functions which use RNGs
22

33
Occasionally a function that uses random number generators might need to be tested. For functions that need to be tested with test vectors, the following approach might be adapted:
44

src/guide-values.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,5 @@ fn main() {
132132
[`Rng::try_fill`]: https://docs.rs/rand/latest/rand/trait.Rng.html#method.try_fill
133133
[`random`]: https://docs.rs/rand/latest/rand/fn.random.html
134134
[`rng()`]: https://docs.rs/rand/latest/rand/fn.rng.html
135+
[`Distribution`]: https://docs.rs/rand/latest/rand/distr/trait.Distribution.html
135136
[`StandardUniform`]: https://docs.rs/rand/latest/rand/distr/struct.StandardUniform.html

src/guide.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
This section attempts to explain some of the concepts used in this library.
44

5-
1. [Getting started with a new crate](guide-cargo.md)
5+
1. [Getting started with a new crate](guide-start.md)
66
1. [What is random data and what is randomness anyway?](guide-data.md)
77
1. [What kind of random generators are there?](guide-gen.md)
88
1. [What random number generators does Rand provide?](guide-rngs.md)
9+
1. [Seeding PRNGs and reproducibility](guide-seeding.md)
10+
1. [Parallel RNGs](guide-parallel.md)
911
1. [Turning random data into useful values](guide-values.md)
1012
1. [Distributions: more control over random values](guide-dist.md)
13+
1. [Random processes: sampling without replacement](guide-process.md)
1114
1. [Sequences](guide-seq.md)
1215
1. [Error handling](guide-err.md)
16+
1. [Testing functions which use RNGs](guide-test-fn-rng.md)
1317

1418
## Importing items (prelude)
1519

0 commit comments

Comments
 (0)