@@ -278,7 +278,7 @@ use distributions::uniform::SampleUniform;
278
278
279
279
/// An automatically-implemented extension trait on [`RngCore`] providing high-level
280
280
/// generic methods for sampling values and other convenience methods.
281
- ///
281
+ ///
282
282
/// This is the primary trait to use when generating random values.
283
283
///
284
284
/// # Generic usage
@@ -322,7 +322,7 @@ pub trait Rng: RngCore {
322
322
///
323
323
/// # Example
324
324
///
325
- /// ```rust
325
+ /// ```
326
326
/// use rand::{thread_rng, Rng};
327
327
///
328
328
/// let mut rng = thread_rng();
@@ -351,7 +351,7 @@ pub trait Rng: RngCore {
351
351
///
352
352
/// # Example
353
353
///
354
- /// ```rust
354
+ /// ```
355
355
/// use rand::{thread_rng, Rng};
356
356
///
357
357
/// let mut rng = thread_rng();
@@ -368,7 +368,7 @@ pub trait Rng: RngCore {
368
368
///
369
369
/// ### Example
370
370
///
371
- /// ```rust
371
+ /// ```
372
372
/// use rand::{thread_rng, Rng};
373
373
/// use rand::distributions::Uniform;
374
374
///
@@ -383,7 +383,7 @@ pub trait Rng: RngCore {
383
383
///
384
384
/// # Example
385
385
///
386
- /// ```rust
386
+ /// ```
387
387
/// use rand::{thread_rng, Rng};
388
388
/// use rand::distributions::{Alphanumeric, Uniform, Standard};
389
389
///
@@ -425,7 +425,7 @@ pub trait Rng: RngCore {
425
425
///
426
426
/// # Example
427
427
///
428
- /// ```rust
428
+ /// ```
429
429
/// use rand::{thread_rng, Rng};
430
430
///
431
431
/// let mut arr = [0i8; 20];
@@ -454,7 +454,7 @@ pub trait Rng: RngCore {
454
454
///
455
455
/// # Example
456
456
///
457
- /// ```rust
457
+ /// ```
458
458
/// # use rand::Error;
459
459
/// use rand::{thread_rng, Rng};
460
460
///
@@ -481,7 +481,7 @@ pub trait Rng: RngCore {
481
481
///
482
482
/// # Example
483
483
///
484
- /// ```rust
484
+ /// ```
485
485
/// use rand::{thread_rng, Rng};
486
486
///
487
487
/// let mut rng = thread_rng();
@@ -546,7 +546,7 @@ pub trait Rng: RngCore {
546
546
///
547
547
/// # Example
548
548
///
549
- /// ```rust
549
+ /// ```
550
550
/// use rand::{thread_rng, Rng};
551
551
///
552
552
/// let mut rng = thread_rng();
@@ -591,7 +591,7 @@ pub trait Rng: RngCore {
591
591
///
592
592
/// # Example
593
593
///
594
- /// ```rust
594
+ /// ```
595
595
/// # #![allow(deprecated)]
596
596
/// use rand::{thread_rng, Rng};
597
597
///
@@ -614,7 +614,7 @@ pub trait Rng: RngCore {
614
614
///
615
615
/// # Example
616
616
///
617
- /// ```rust
617
+ /// ```
618
618
/// # #![allow(deprecated)]
619
619
/// use rand::{thread_rng, Rng};
620
620
///
@@ -642,7 +642,7 @@ impl<R: RngCore + ?Sized> Rng for R {}
642
642
/// PRNGs, though two alternatives may be considered:
643
643
///
644
644
/// * Deterministic creation using [`SeedableRng::from_seed`] with a fixed seed
645
- /// * Seeding from `thread_rng`: `SeedableRng::from_rng(thread_rng())?`;
645
+ /// * Seeding from [ `thread_rng`] : `SeedableRng::from_rng(thread_rng())?`;
646
646
/// this will usually be faster and should also be secure, but requires
647
647
/// trusting one extra component.
648
648
///
@@ -655,9 +655,10 @@ impl<R: RngCore + ?Sized> Rng for R {}
655
655
/// println!("Random die roll: {}", rng.gen_range(1, 7));
656
656
/// ```
657
657
///
658
- /// [`EntropyRng`]: struct.EntropyRng.html
658
+ /// [`EntropyRng`]: rngs/ struct.EntropyRng.html
659
659
/// [`SeedableRng`]: trait.SeedableRng.html
660
660
/// [`SeedableRng::from_seed`]: trait.SeedableRng.html#tymethod.from_seed
661
+ /// [`thread_rng`]: fn.thread_rng.html
661
662
#[ cfg( feature="std" ) ]
662
663
pub trait FromEntropy : SeedableRng {
663
664
/// Creates a new instance, automatically seeded with fresh entropy.
@@ -672,7 +673,7 @@ pub trait FromEntropy: SeedableRng {
672
673
/// If all entropy sources fail this will panic. If you need to handle
673
674
/// errors, use the following code, equivalent aside from error handling:
674
675
///
675
- /// ```rust
676
+ /// ```
676
677
/// # use rand::Error;
677
678
/// use rand::{Rng, StdRng, EntropyRng, SeedableRng};
678
679
///
@@ -703,6 +704,9 @@ impl<R: SeedableRng> FromEntropy for R {
703
704
/// documentation of the entropy source and [`Standard`] for documentation of
704
705
/// distributions and type-specific generation.
705
706
///
707
+ /// Use [`thread_rng`] directly when you need more features, for example
708
+ /// `thread_rng().gen_range(a, b)` to generate values uniformly in some range.
709
+ ///
706
710
/// # Examples
707
711
///
708
712
/// ```
0 commit comments