Skip to content

Commit

Permalink
Merge pull request #45 from vks/quickstart-examples
Browse files Browse the repository at this point in the history
Quickstart examples
  • Loading branch information
vks committed Nov 27, 2023
2 parents 73da25c + f707649 commit 0f25f7e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
3 changes: 3 additions & 0 deletions rand_hc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
// except according to those terms.

//! The HC128 random number generator.
//!
//! To initialize a generator, use the [`SeedableRng`][rand_core::SeedableRng] trait.

#![doc(
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://rust-random.github.io/rand/"
)]
#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
Expand Down
4 changes: 3 additions & 1 deletion rand_isaac/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Developers of the Rand project.
// Copyright 2018-2023 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand All @@ -7,6 +7,8 @@
// except according to those terms.

//! The ISAAC and ISAAC-64 random number generators.
//!
//! To initialize a generator, use the [`SeedableRng`][rand_core::SeedableRng] trait.

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
Expand Down
15 changes: 14 additions & 1 deletion rand_xorshift/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Developers of the Rand project.
// Copyright 2018-2023 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand All @@ -7,11 +7,24 @@
// except according to those terms.

//! The xorshift random number generator.
//!
//! # Example
//!
//! To initialize a generator, use the [`SeedableRng`][rand_core::SeedableRng] trait:
//!
//! ```
//! use rand_core::{SeedableRng, RngCore};
//! use rand_xorshift::XorShiftRng;
//!
//! let mut rng = XorShiftRng::seed_from_u64(0);
//! let x = rng.next_u32();
//! ```

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://docs.rs/rand_xorshift/0.3.0")]

#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]

Expand Down
19 changes: 16 additions & 3 deletions rand_xoshiro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Developers of the Rand project.
// Copyright 2018-2023 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand All @@ -8,7 +8,7 @@

//! This crate implements the [xoshiro] family of pseudorandom number generators
//! designed by David Blackman and Sebastiano Vigna. They feature high
//! perfomance and a small state and supersede the previous xorshift-based
//! performance and a small state and supersede the previous xorshift-based
//! generators. However, they are not cryptographically secure and their output
//! can be predicted by observing a few samples.
//!
Expand Down Expand Up @@ -61,9 +61,21 @@
//! lowest bits (which are discarded when generating floats), making it fail
//! linearity tests. This is unlikely to have any impact in practise.
//!
//! The `*PlusPlus` generators perform similarily to the `*StarStar` generators.
//! The `*PlusPlus` generators perform similarly to the `*StarStar` generators.
//! See the [xoshiro paper], where the differences are discussed in detail.
//!
//! # Example
//!
//! To initialize a generator, use the [`SeedableRng`][rand_core::SeedableRng] trait:
//!
//! ```
//! use rand_core::{SeedableRng, RngCore};
//! use rand_xoshiro::Xoshiro256PlusPlus;
//!
//! let mut rng = Xoshiro256PlusPlus::seed_from_u64(0);
//! let x = rng.next_u64();
//! ```
//!
//! [xoshiro]: http://xoshiro.di.unimi.it/
//! [xoshiro paper]: http://vigna.di.unimi.it/ftp/papers/ScrambledLinear.pdf
//! [low linear complexity]: http://xoshiro.di.unimi.it/lowcomp.php
Expand All @@ -72,6 +84,7 @@
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://docs.rs/rand_xoshiro/0.6.0")]

#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![allow(clippy::unreadable_literal)]
Expand Down

0 comments on commit 0f25f7e

Please sign in to comment.