Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[book]
authors = ["The Rand Project Developers"]
multilingual = false
src = "src"
title = "The Rust Rand Book"
description = "Extended documentation for Rust's Rand lib"
language = "en"

[output.html.playgen]
[rust]
edition = "2024"

[output.html.playground]
editable = true

[output.linkcheck]
# [output.linkcheck]
# NOTE: this requires https://github.com/Michael-F-Bryan/mdbook-linkcheck
2 changes: 1 addition & 1 deletion src/guide-dist.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Lets go over the distributions by type:
support requires using the `simd_support` feature flag and nightly `rustc`.
- For enums, you have to implement uniform sampling yourself. For example, you
could use the following approach:
```rust
```rust,noplayground
# use rand::{Rng, distr::{Distribution, StandardUniform}};
pub enum Food {
Burger,
Expand Down
2 changes: 1 addition & 1 deletion src/guide-test-fn-rng.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() {

To test this, we can create a `MockCryptoRng` implementing `TryRngCore` and `TryCryptoRng` in our testing module. Note that `MockCryptoRng` is private and `#[cfg(test)] mod tests` is cfg-gated to our test environment, thus ensuring that `MockCryptoRng` cannot accidentally be used in production.

```rust
```rust,noplayground
#[cfg(test)]
mod tests {
use super::*;
Expand Down
7 changes: 4 additions & 3 deletions src/update-0.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ A new trait has been added: `FromEntropy`. This is automatically implemented for
any type supporting `SeedableRng`, and provides construction from fresh, strong
entropy:

```rust
```rust,noplayground
use rand_0_5::{ChaChaRng, FromEntropy};

let mut rng = ChaChaRng::from_entropy();
Expand Down Expand Up @@ -120,7 +120,8 @@ use cannot be guaranteed.*
A new `Error` type has been added, designed explicitly for no-std compatibility,
simplicity, and enough flexibility for our uses (carrying a `cause` when
possible):
```ignore
```rust,noplayground
# use rand_0_5::ErrorKind;
pub struct Error {
pub kind: ErrorKind,
pub msg: &'static str,
Expand Down Expand Up @@ -181,7 +182,7 @@ The method `ChaChaRng::set_counter` has been replaced by two new methods,
`set_word_pos` and `set_stream`. Where necessary, the behaviour of the old
method may be emulated as follows:

```rust
```rust,noplayground
# extern crate rand;
# extern crate rand_chacha;
# use rand::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/update-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The [`FromEntropy`] trait has now been removed. Fear not though, its
[`from_entropy`] method continues to provide easy initialisation from its new
home in the [`SeedableRng`] trait (this requires that `rand_core` has the `std`
or `getrandom` feature enabled):
```rust
```rust,noplayground
# extern crate rand_0_7 as rand;
use rand::{SeedableRng, rngs::StdRng};
let mut rng = StdRng::from_entropy();
Expand Down
4 changes: 2 additions & 2 deletions src/update-0.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let a: u32 = Standard.sample_iter(rng).next().unwrap();
let b: u32 = Standard.sample_iter(rng).next().unwrap();
```
can be replaced with the following code:
```rust
```rust,noplayground
# extern crate rand;
# use rand_0_8::prelude::*;
# use rand_0_8::distributions::Standard;
Expand Down Expand Up @@ -130,7 +130,7 @@ Several smaller changes occurred to rand distributions:
.collect();
```
With Rand 0.8, this is equivalent to the following:
```rust
```rust,noplayground
# extern crate rand;
# use rand_0_8::{distributions::Alphanumeric, Rng};
# fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tests"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
Loading