|
1 |
| -// Copyright 2018 Developers of the Rand project. |
| 1 | +// Copyright 2018-2023 Developers of the Rand project. |
2 | 2 | //
|
3 | 3 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
4 | 4 | // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
8 | 8 |
|
9 | 9 | //! This crate implements the [xoshiro] family of pseudorandom number generators
|
10 | 10 | //! designed by David Blackman and Sebastiano Vigna. They feature high
|
11 |
| -//! perfomance and a small state and supersede the previous xorshift-based |
| 11 | +//! performance and a small state and supersede the previous xorshift-based |
12 | 12 | //! generators. However, they are not cryptographically secure and their output
|
13 | 13 | //! can be predicted by observing a few samples.
|
14 | 14 | //!
|
|
61 | 61 | //! lowest bits (which are discarded when generating floats), making it fail
|
62 | 62 | //! linearity tests. This is unlikely to have any impact in practise.
|
63 | 63 | //!
|
64 |
| -//! The `*PlusPlus` generators perform similarily to the `*StarStar` generators. |
| 64 | +//! The `*PlusPlus` generators perform similarly to the `*StarStar` generators. |
65 | 65 | //! See the [xoshiro paper], where the differences are discussed in detail.
|
66 | 66 | //!
|
| 67 | +//! # Example |
| 68 | +//! |
| 69 | +//! To initialize a generator, use the [`SeedableRng`][rand_core::SeedableRng] trait: |
| 70 | +//! |
| 71 | +//! ``` |
| 72 | +//! use rand_core::{SeedableRng, RngCore}; |
| 73 | +//! use rand_xoshiro::Xoshiro256PlusPlus; |
| 74 | +//! |
| 75 | +//! let mut rng = Xoshiro256PlusPlus::seed_from_u64(0); |
| 76 | +//! let x = rng.next_u64(); |
| 77 | +//! ``` |
| 78 | +//! |
67 | 79 | //! [xoshiro]: http://xoshiro.di.unimi.it/
|
68 | 80 | //! [xoshiro paper]: http://vigna.di.unimi.it/ftp/papers/ScrambledLinear.pdf
|
69 | 81 | //! [low linear complexity]: http://xoshiro.di.unimi.it/lowcomp.php
|
|
72 | 84 | html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
73 | 85 | html_root_url = "https://docs.rs/rand_xoshiro/0.6.0")]
|
74 | 86 |
|
| 87 | +#![forbid(unsafe_code)] |
75 | 88 | #![deny(missing_docs)]
|
76 | 89 | #![deny(missing_debug_implementations)]
|
77 | 90 | #![allow(clippy::unreadable_literal)]
|
|
0 commit comments